buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <cstdio> int main() { int dice[6]; int a, b, x, y, q, t = 0; int ans[6][6] = {{0, 3, 5, 2, 4, 0}, {4, 0, 1, 6, 0, 3}, {2, 6, 0, 0, 1, 5}, {5, 1, 0, 0, 6, 2}, {3, 0, 6, 1, 0, 4}, {0, 4, 2, 5, 3, 0}}; scanf("%d %d %d %d %d %d", &dice[0], &dice[1], &dice[2], &dice[3], &dice[4], ...
#include <cstdio> int main() { int dice[6]; int a, b, x, y, q, t = 0; int ans[6][6] = {{0, 3, 5, 2, 4, 0}, {4, 0, 1, 6, 0, 3}, {2, 6, 0, 0, 1, 5}, {5, 1, 0, 0, 6, 2}, {3, 0, 6, 1, 0, 4}, {0, 4, 2, 5, 3, 0}}; scanf("%d %d %d %d %d %d", &dice[0], &dice[1], &dice[2], &dice[3], &dice[4], ...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
267
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> typedef struct { int Up; int Sorth; int East; int West; int North; int Down; } DICE; /* DICE North(DICE *t); DICE Sorth(DICE *t); DICE East(DICE *t); DICE West(DICE *t); DICE Rot(DICE *t); */ void assignment(DICE *t); int main() { unsigned in...
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> typedef struct { int Up; int Sorth; int East; int West; int North; int Down; } DICE; /* DICE North(DICE *t); DICE Sorth(DICE *t); DICE East(DICE *t); DICE West(DICE *t); DICE Rot(DICE *t); ...
[["-", 0, 1, 0, 2, 3, 4, 0, 118, 119, 120], ["+", 0, 1, 0, 2, 3, 4, 0, 118, 119, 120]]
1
805
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, a) REP(i, 0, a) #define REP(i, a, b) for (int i = a; i < b; ++i) t...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, a) REP(i, 0, a) #define REP(i, a, b) for (int i = a; i < b; ++i) t...
[["+", 341, 342, 0, 16, 31, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["+", 341, 342, 0, 16, 31, 16, 31, 23, 0, 25], ["-", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
708
#include <iostream> using namespace std; int main() { int y[7]; int x[6][6] = {{0, 3, 5, 2, 4, 0}, {4, 0, 1, 6, 0, 3}, {2, 6, 0, 0, 1, 5}, {5, 1, 0, 0, 6, 2}, {3, 0, 6, 1, 0, 4}, {0, 4, 2, 5, 3, 0}}; int a, b, c, d; int q; cin >> y[1] >> y[2] >> y[3] >> y[4] >> y[5] >> y[6]; cin >> q; fo...
#include <iostream> using namespace std; int main() { int y[7]; int x[6][6] = {{0, 3, 5, 2, 4, 0}, {4, 0, 1, 6, 0, 3}, {2, 6, 0, 0, 1, 5}, {5, 1, 0, 0, 6, 2}, {3, 0, 6, 1, 0, 4}, {0, 4, 2, 5, 3, 0}}; int a, b, c, d; int q; cin >> y[1] >> y[2] >> y[3] >> y[4] >> y[5] >> y[6]; cin >> q; fo...
[["+", 0, 1, 0, 16, 31, 16, 12, 69, 28, 22], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 70], ["+", 12, 69, 341, 342, 0, 69, 341, 342, 0, 73]]
1
248
#include <iostream> using namespace std; int main() { int dice[6]; int pos[6][6] = {{0, 3, 5, 4, 2, 0}, {4, 0, 1, 6, 0, 3}, {2, 6, 0, 0, 1, 5}, {5, 1, 0, 0, 6, 2}, {3, 0, 6, 1, 0, 4}, {0, 4, 2, 5, 3, 0}}; int a, b, ap, bp, n; for (int i = 0; i < 6; i++) cin >> dice[i]; cin >> n; for...
#include <iostream> using namespace std; int main() { int dice[6]; int pos[6][6] = {{0, 3, 5, 2, 4, 0}, {4, 0, 1, 6, 0, 3}, {2, 6, 0, 0, 1, 5}, {5, 1, 0, 0, 6, 2}, {3, 0, 6, 1, 0, 4}, {0, 4, 2, 5, 3, 0}}; int a, b, ap, bp, n; for (int i = 0; i < 6; i++) cin >> dice[i]; cin >> n; for...
[["-", 0, 43, 49, 50, 51, 83, 0, 83, 0, 13], ["-", 0, 43, 49, 50, 51, 83, 0, 83, 0, 21], ["+", 0, 43, 49, 50, 51, 83, 0, 83, 0, 21], ["+", 0, 43, 49, 50, 51, 83, 0, 83, 0, 13]]
1
233
#include <iostream> using namespace std; class Cube { public: int f[6]; Cube() {} void roll_z() { roll(1, 2, 4, 3); } // void roll_y() { roll(0, 2, 5, 7); } // to W void roll_x() { roll(0, 1, 5, 4); } // to N void roll(int i, int j, int k, int l) { int t = f[i]; f[i] = f[j]; f[j] = f[k]; f...
#include <iostream> using namespace std; class Cube { public: int f[6]; Cube() {} void roll_z() { roll(1, 2, 4, 3); } // void roll_y() { roll(0, 2, 5, 3); } // to W void roll_x() { roll(0, 1, 5, 4); } // to N void roll(int i, int j, int k, int l) { int t = f[i]; f[i] = f[j]; f[j] = f[k]; f...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
326
#include <iostream> using namespace std; struct Dice { int top; int north; int east; int south; int west; int bottom; }; void rotn(void); void rote(void); void rots(void); void rotw(void); Dice d; int tmp; int main() { int i, q, t, f, r; char com; cin >> d.top >> d.south >> d.east >> d.west >> d.n...
#include <iostream> using namespace std; struct Dice { int top; int north; int east; int south; int west; int bottom; }; void rotn(void); void rote(void); void rots(void); void rotw(void); Dice d; int tmp; int main() { int i, q, t, f, r; cin >> d.top >> d.south >> d.east >> d.west >> d.north >> d.bo...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 57, 64, 1, 0, 11, 12, 118, 119, 120], ["+", 0, 57, 64, 1, 0, 11, 12, 118, 119, 120]]
1
440
#include <algorithm> #include <iostream> #include <vector> using namespace std; class Dice { public: long top, front, right, left, back, bottom; Dice(long top, long front); void north(); void south(); void west(); void east(); void showTop(); void guessRightFromTopAndFront(long top, long front, long *r...
#include <algorithm> #include <iostream> #include <vector> using namespace std; class Dice { public: long top, front, right, left, back, bottom; Dice(long top, long front); void north(); void south(); void west(); void east(); void showTop(); void guessRightFromTopAndFront(long top, long front, long *r...
[["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
1,488
#include <iostream> #include <map> #include <vector> using namespace std; class Dice { public: vector<int> d; void spin(string s) { if (s == "S") { swap(d[0], d[4]); swap(d[4], d[1]); swap(d[4], d[5]); } if (s == "E") { swap(d[0], d[3]); swap(d[2], d[3]); swap(d[3], ...
#include <iostream> #include <map> #include <vector> using namespace std; class Dice { public: vector<int> d; void spin(string s) { if (s == "S") { swap(d[0], d[4]); swap(d[4], d[1]); swap(d[4], d[5]); } if (s == "E") { swap(d[0], d[3]); swap(d[2], d[3]); swap(d[3], ...
[["-", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 61, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 61, 0, 5, 0, 62]]
1
408
#include <stdio.h> int a[6], q, s, t, u, v; const int r[6][6] = {{7, 2, 4, 1, 3, 7}, {3, 7, 0, 5, 7, 2}, {1, 5, 7, 7, 0, 4}, {4, 0, 7, 7, 5, 1}, {2, 7, 5, 0, 7, 3}, {7, 3, 1, 4, 2, 7}}; int main() { for (int i = 0; i < 6; i++) scanf("%d", &a[i]); scanf("%d", &q); for ...
#include <stdio.h> int a[6], q, s, t, u, v; const int r[6][6] = {{7, 2, 4, 1, 3, 7}, {3, 7, 0, 5, 7, 2}, {1, 5, 7, 7, 0, 4}, {4, 0, 7, 7, 5, 1}, {2, 7, 5, 0, 7, 3}, {7, 3, 1, 4, 2, 7}}; int main() { for (int i = 0; i < 6; i++) scanf("%d", &a[i]); scanf("%d", &q); for ...
[["-", 0, 69, 28, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 69, 28, 69, 341, 342, 0, 16, 12, 13], ["-", 341, 342, 0, 69, 341, 342, 0, 16, 17, 33], ["-", 341, 342, 0, 69, 341, 342, 0, 16, 12, 13]]
1
254
/******** * ??????????????? *********/ /*********??¢?????´????????? * ??????????????????????????????????????\????????¢???????????????4??¢???1?????????????????????????????? * ???????????´??¢?????????????????????????????§?????????????????? *********/ #include <iostream> #include <stdio.h> using namespace std; int ...
/******** * ??????????????? *********/ /*********??¢?????´????????? * ??????????????????????????????????????\????????¢???????????????4??¢???1?????????????????????????????? * ???????????´??¢?????????????????????????????§?????????????????? *********/ #include <iostream> #include <stdio.h> using namespace std; int ...
[["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 13], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 13]]
1
686
#include <bits/stdc++.h> using namespace std; int main() { vector<int> data(7); map<int, int> d; for (size_t i = 1; i <= 6; i++) { cin >> data[i]; d[data[i]] = i; } int N; cin >> N; for (size_t i = 0; i < N; i++) { int a, b; cin >> a >> b; int x = d[a], y = d[b]; if (x == 1) { ...
#include <bits/stdc++.h> using namespace std; int main() { vector<int> data(7); map<int, int> d; for (size_t i = 1; i <= 6; i++) { cin >> data[i]; d[data[i]] = i; } int N; cin >> N; for (size_t i = 0; i < N; i++) { int a, b; cin >> a >> b; int x = d[a], y = d[b]; if (x == 1) { ...
[["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 13], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 13]]
1
464
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) #define repb(i, a, b) for (int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define int long long using namespace std; class dice { public: int top, bottom, right, left, front, back; void North(); void East(); void South(); vo...
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) #define repb(i, a, b) for (int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define int long long using namespace std; class dice { public: int top, bottom, right, left, front, back; void North(); void East(); void South(); vo...
[["-", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6], ["+", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13]]
1
441
#include <iostream> #include <string> using namespace std; class Dice { private: int D1; int D2; int D3; int D4; int D5; int D6; public: Dice(int d1, int d2, int d3, int d4, int d5, int d6) { D1 = d1; D2 = d2; D2 = d2; D3 = d3; D4 = d4; D5 = d5; D6 = d6; } void roll(cha...
#include <iostream> #include <string> using namespace std; class Dice { private: int D1; int D2; int D3; int D4; int D5; int D6; public: Dice(int d1, int d2, int d3, int d4, int d5, int d6) { D1 = d1; D2 = d2; D2 = d2; D3 = d3; D4 = d4; D5 = d5; D6 = d6; } void roll(cha...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
456
#include <iostream> #include <vector> using namespace std; int main() { vector<int> a(6); for (int b = 0; b < 6; b++) { int c; cin >> c; a[b] = c; } int s; cin >> s; for (int k = 0; k < s; k++) { int l, r; cin >> l >> r; for (int d = 0; d < 4; d++) { vector<int> f(6); fo...
#include <iostream> #include <vector> using namespace std; int main() { vector<int> a(6); for (int b = 0; b < 6; b++) { int c; cin >> c; a[b] = c; } int s; cin >> s; for (int k = 0; k < s; k++) { int l, r; cin >> l >> r; for (int d = 0; d < 4; d++) { vector<int> f(6); fo...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["-", 31, 16, 12, 16, 12, 69, 341, 342, 0, 13], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 13]]
1
334
#include <iostream> using namespace std; int main() { int Dice[6]; int q; int up; int forward; int tmp; int i, j, k; for (i = 0; i < 6; i++) { cin >> Dice[i]; } cin >> q; for (i = 0; i < q; i++) { cin >> up >> forward; for (j = 0; j < 4; j++) { tmp = Dice[0]; Dice[0] = Di...
#include <iostream> using namespace std; int main() { int Dice[6]; int q; int up; int forward; int tmp; int i, j, k; for (i = 0; i < 6; i++) { cin >> Dice[i]; } cin >> q; for (i = 0; i < q; i++) { cin >> up >> forward; for (j = 0; j < 4; j++) { tmp = Dice[0]; Dice[0] = Di...
[["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 7, 10, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 10, 11, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22], ["-", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46...
1
355
#include <bits/stdc++.h> using namespace std; struct die { int val[6]; void N() { int tmp[6]; for (int i = 0; i < 6; i++) { tmp[i] = val[i]; } val[0] = tmp[1]; val[4] = tmp[0]; val[5] = tmp[4]; val[1] = tmp[5]; } void E() { int tmp[6]; for (int i = 0; i < 6; i++) { ...
#include <bits/stdc++.h> using namespace std; struct die { int val[6]; void N() { int tmp[6]; for (int i = 0; i < 6; i++) { tmp[i] = val[i]; } val[0] = tmp[1]; val[4] = tmp[0]; val[5] = tmp[4]; val[1] = tmp[5]; } void E() { int tmp[6]; for (int i = 0; i < 6; i++) { ...
[["-", 0, 16, 12, 16, 31, 69, 341, 342, 0, 13], ["+", 0, 16, 12, 16, 31, 69, 341, 342, 0, 13], ["-", 0, 16, 31, 16, 31, 69, 341, 342, 0, 13], ["+", 0, 16, 31, 16, 31, 69, 341, 342, 0, 13]]
1
858
#include "bits/stdc++.h" using namespace std; class Cube { public: int f[6]; Cube() {} void roll_z() { roll(1, 2, 4, 3); } void roll_y() { roll(0, 2, 5, 3); } // to W void roll_x() { roll(0, 1, 5, 4); } // to N void roll(int i, int j, int k, int l) { int t = f[i]; f[i] = f[j]; f[j] = f[k]; ...
#include "bits/stdc++.h" using namespace std; class Cube { public: int f[6]; Cube() {} void roll_z() { roll(1, 2, 4, 3); } void roll_y() { roll(0, 2, 5, 3); } // to W void roll_x() { roll(0, 1, 5, 4); } // to N void roll(int i, int j, int k, int l) { int t = f[i]; f[i] = f[j]; f[j] = f[k]; ...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
421
#include <iostream> #include <string> using namespace std; class Dice { public: int a, s, e, w, n, b; int r[6] = {1, 2, 3, 4, 5, 6}; void setint(int a1, int s1, int e1, int w1, int n1, int b1); int geta(); int gets(); int getn(); int gete(); int getw(); int getb(); void moveS(); void moveN(); v...
#include <iostream> #include <string> using namespace std; class Dice { public: int a, s, e, w, n, b; int r[6] = {1, 2, 3, 4, 5, 6}; void setint(int a1, int s1, int e1, int w1, int n1, int b1); int geta(); int gets(); int getn(); int gete(); int getw(); int getb(); void moveS(); void moveN(); v...
[["+", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 70], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 73]]
1
1,010
#include <iostream> #include <math.h> #include <stdio.h> #include <string> #include <vector> class dice { private: int a, b, c, d, e, f, inas, inbs, ans; std::vector<int> list = {0, 1, 2, 3, 4, 5}; std::vector<int> listb = {0, 1, 2, 3, 4, 5}; std::vector<int> listc = {0, 1, 2, 3, 4, 5}; public: dice(int i, i...
#include <iostream> #include <math.h> #include <stdio.h> #include <string> #include <vector> class dice { private: int a, b, c, d, e, f, inas, inbs, ans; std::vector<int> list = {0, 1, 2, 3, 4, 5}; std::vector<int> listb = {0, 1, 2, 3, 4, 5}; std::vector<int> listc = {0, 1, 2, 3, 4, 5}; public: dice(int i, i...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
1,126
//============================================================================ // Name : ITP_1_11_B.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include...
//============================================================================ // Name : ITP_1_11_B.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include...
[["-", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13], ["+", 0, 57, 64, 9, 0, 37, 0, 69, 28, 22], ["+", 64, 9, 0, 37, 0, 69, 341, 342, 0, 70], ["+", 64, 9, 0, 37, 0, 69, 341, 342, 0, 13], ["+", 64, 9, 0, 37, 0, 69, 341, 342, 0, 73]]
1
683
#include <stdio.h> typedef struct Dice { int d[6]; int r[6]; int b[6]; } dice; int main(void) { dice num; int q, i, c; int u[24], p[24], re[24] = {0}; for (i = 0; i < 6; i++) { scanf("%d", &num.d[i]); } scanf("%d", &q); for (i = 0; i < q; i++) { scanf("%d %d", &u[i], &p[i]); } for (int k...
#include <stdio.h> typedef struct Dice { int d[6]; int r[6]; int b[6]; } dice; int main(void) { dice num; int q, i, c; int u[24], p[24], re[24] = {0}; for (i = 0; i < 6; i++) { scanf("%d", &num.d[i]); } scanf("%d", &q); for (i = 0; i < q; i++) { scanf("%d %d", &u[i], &p[i]); } for (int k...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
726
#include <iostream> #include <map> using namespace std; int main() { map<int, int> m; map<int, int> r; int a[6], n, x, y; int d[6][6] = {{0, 3, 5, 2, 4, 0}, {4, 0, 1, 6, 0, 3}, {2, 6, 0, 0, 1, 5}, {6, 1, 0, 0, 6, 2}, {3, 0, 6, 1, 0, 4}, {0, 4, 2, 5, 3, 0}}; for (int i = 0; i < 6; i++) { ...
#include <iostream> #include <map> using namespace std; int main() { map<int, int> m; map<int, int> r; int a[6], n, x, y; int d[6][6] = {{0, 3, 5, 2, 4, 0}, {4, 0, 1, 6, 0, 3}, {2, 6, 0, 0, 1, 5}, {5, 1, 0, 0, 6, 2}, {3, 0, 6, 1, 0, 4}, {0, 4, 2, 5, 3, 0}}; for (int i = 0; i < 6; i++) { ...
[["-", 0, 43, 49, 50, 51, 83, 0, 83, 0, 13], ["+", 0, 43, 49, 50, 51, 83, 0, 83, 0, 13]]
1
248
#include <iostream> #include <math.h> #include <string> #define MEN 6 #include <iomanip> using namespace std; struct DICE { int num; }; int main() { DICE A[MEN]; int out[24]; int q, x, y; int i = 0; for (int i = 0; i < MEN; i++) { cin >> A[i].num; } cin >> q; for (int i = 0; i < q; i++) { ...
#include <iostream> #include <math.h> #include <string> #define MEN 6 #include <iomanip> using namespace std; struct DICE { int num; }; int main() { DICE A[MEN]; int out[24]; int q, x, y; int i = 0; for (int i = 0; i < MEN; i++) { cin >> A[i].num; } cin >> q; for (int i = 0; i < q; i++) { ...
[["-", 51, 16, 12, 118, 28, 69, 341, 342, 0, 13], ["+", 51, 16, 12, 118, 28, 69, 341, 342, 0, 13], ["-", 0, 11, 12, 118, 28, 69, 341, 342, 0, 13], ["+", 0, 11, 12, 118, 28, 69, 341, 342, 0, 13]]
1
833
#include <bits/stdc++.h> using namespace std; struct dice { vector<int> diceindex{0, 1, 2, 3, 4, 5}; vector<int> dicenum{1, 2, 3, 4, 5, 6}; void setNumber(vector<int> &setnum) { for (int i = 0; i < 6; i++) { dicenum[diceindex[i]] = setnum[diceindex[i]]; } return; } vector<int> getNumber(...
#include <bits/stdc++.h> using namespace std; struct dice { vector<int> diceindex{0, 1, 2, 3, 4, 5}; vector<int> dicenum{1, 2, 3, 4, 5, 6}; void setNumber(vector<int> &setnum) { for (int i = 0; i < 6; i++) { dicenum[diceindex[i]] = setnum[diceindex[i]]; } return; } vector<int> getNumber(...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
754
#include <cstdio> using namespace std; class Dice { public: int face[6]; Dice() {} int roll(int a, int b, int c, int d) { int temp = face[a]; face[a] = face[b]; face[b] = face[c]; face[c] = face[d]; face[d] = temp; return 0; } int move(char c) { if (c == 'W') roll(0, 2, 5, 3...
#include <cstdio> using namespace std; class Dice { public: int face[6]; Dice() {} int roll(int a, int b, int c, int d) { int temp = face[a]; face[a] = face[b]; face[b] = face[c]; face[c] = face[d]; face[d] = temp; return 0; } int move(char c) { if (c == 'W') roll(0, 2, 5, 3...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
429
#include <iostream> #include <string> using namespace std; class dice { public: int t[7][6]; dice() { //?????????????????????????????? } void ready() { t[1][1] = t[5][0], t[1][2] = t[4][0], t[1][3] = t[2][0], t[1][4] = t[5][0], t[1][5] = t[5][0]; t[2][1] = t[1][0], t[2][2] = t[4][0], t[2][3] = t[...
#include <iostream> #include <string> using namespace std; class dice { public: int t[7][6]; dice() { //?????????????????????????????? } void ready() { t[1][1] = t[5][0], t[1][2] = t[4][0], t[1][3] = t[2][0], t[1][4] = t[3][0], t[1][5] = t[5][0]; t[2][1] = t[1][0], t[2][2] = t[4][0], t[2][3] = t[...
[["-", 31, 11, 12, 69, 28, 69, 341, 342, 0, 13], ["+", 31, 11, 12, 69, 28, 69, 341, 342, 0, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
683
#include <iostream> using namespace std; int faces[1 + 6]; void roll(int f) { int tmp = faces[f]; faces[f] = faces[1]; faces[1] = faces[7 - f]; faces[7 - f] = faces[6]; faces[6] = tmp; } int main() { int input[1 + 6]; for (int i = 1; i <= 6; i++) { cin >> input[i]; } int n, top, front, right,...
#include <iostream> using namespace std; int faces[1 + 6]; void roll(int f) { int tmp = faces[f]; faces[f] = faces[1]; faces[1] = faces[7 - f]; faces[7 - f] = faces[6]; faces[6] = tmp; } int main() { int input[1 + 6]; for (int i = 1; i <= 6; i++) { cin >> input[i]; } int n, top, front, right,...
[["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
348
#include <cstdlib> #include <iomanip> #include <iostream> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> using namespace std; int main() { int x[7]; for (int i = 1; i < 7; i++) { cin >> x[i]; } int n = 0; cin >> n; bool t[7][7]; memset(t, 0, 7 * 7 * sizeof(bool)); t...
#include <cstdlib> #include <iomanip> #include <iostream> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> using namespace std; int main() { int x[7]; for (int i = 1; i < 7; i++) { cin >> x[i]; } int n = 0; cin >> n; bool t[7][7]; memset(t, 0, 7 * 7 * sizeof(bool)); t...
[["-", 64, 1, 0, 16, 31, 16, 12, 23, 0, 24], ["+", 64, 1, 0, 16, 31, 16, 12, 69, 28, 22], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 70], ["-", 64, 1, 0, 16, 31, 16, 12, 23, 0, 25], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 73], ["+", 0, 1, 0, 16, 31, 16, 12, 69, 28, 22]]
1
318
#include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <sstream> using namespace std; #define MPI 3.14159265358979323846 struct Dice { int num[6]; void roll(int, int, int &); }; void Dice::roll(int c1, int c2, int &ans) { if (c1 == num[0]) { if (c2 == num[1]) ...
#include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <sstream> using namespace std; #define MPI 3.14159265358979323846 struct Dice { int num[6]; void roll(int, int, int &); }; void Dice::roll(int c1, int c2, int &ans) { if (c1 == num[0]) { if (c2 == num[1]) ...
[["-", 64, 1, 0, 11, 12, 69, 341, 342, 0, 13], ["+", 64, 1, 0, 11, 12, 69, 341, 342, 0, 13]]
1
696
#include <iostream> using namespace std; int main() { int d[7], g; cin >> d[1] >> d[2] >> d[3] >> d[4] >> d[5] >> d[6] >> g; for (int i = 0; i < g; i++) { int x, y; cin >> x >> y; if (x != d[1]) { if (x == d[2]) { int t = d[2]; d[2] = d[6]; d[6] = d[5]; d[5] = d[...
#include <iostream> using namespace std; int main() { int d[7], g; cin >> d[1] >> d[2] >> d[3] >> d[4] >> d[5] >> d[6] >> g; for (int i = 0; i < g; i++) { int x, y; cin >> x >> y; if (x != d[1]) { if (x == d[2]) { int t = d[2]; d[2] = d[6]; d[6] = d[5]; d[5] = d[...
[["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 13]]
1
558
#include <bits/stdc++.h> using namespace std; /* if(x=='N') {m1=d2;m2=d6;m6=d5;m5=d1; } if(x=='S') {m1=d5;m5=d6;m6=d2;m2=d1; } if(x=='W') {m3=d6;m6=d4;m4=d1;m1=d3; } if(x=='E') {m6=d3;m3=d1;m1=d4;m4=d6; } */ int main() { // DICE input int d1, d2, d3, d...
#include <bits/stdc++.h> using namespace std; /* if(x=='N') {m1=d2;m2=d6;m6=d5;m5=d1; } if(x=='S') {m1=d5;m5=d6;m6=d2;m2=d1; } if(x=='W') {m3=d6;m6=d4;m4=d1;m1=d3; } if(x=='E') {m6=d3;m3=d1;m1=d4;m4=d6; } */ int main() { // DICE input int d1, d2, d3, d...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
652
#include <algorithm> #include <iostream> using namespace std; int main() { int a[7], m; int right[25] = {0, 2, 3, 5, 4, 1, 4, 6, 3, 1, 2, 6, 5, 1, 5, 6, 6, 1, 3, 6, 4, 2, 4, 5, 3}; for (int i = 1; i < 7; i++) { cin >> a[i]; } cin >> m; for (int i = 0; i < m; i++) { int top, front;...
#include <algorithm> #include <iostream> using namespace std; int main() { int a[7], m; int right[25] = {0, 2, 3, 5, 4, 1, 4, 6, 3, 1, 2, 6, 5, 1, 5, 6, 2, 1, 3, 6, 4, 2, 4, 5, 3}; for (int i = 1; i < 7; i++) { cin >> a[i]; } cin >> m; for (int i = 0; i < m; i++) { int top, front;...
[["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13]]
1
243
while true n = gets.to_i break if n == 0 s = gets.split.map(&:to_i) mean = s.sum / n sum_of_squares = s.inject(0){|sum, i| sum + (i - mean) ** 2 } s2 = sum_of_squares / n ans = Math.sqrt(s2) puts ans end
while true n = gets.to_f break if n == 0 s = gets.split.map(&:to_f) mean = s.sum / n sum_of_squares = s.inject(0){|sum, i| sum + (i - mean) ** 2 } s2 = sum_of_squares / n ans = Math.sqrt(s2) puts ans end
[["-", 0, 89, 8, 170, 0, 662, 12, 652, 735, 22], ["+", 0, 89, 8, 170, 0, 662, 12, 652, 735, 22], ["-", 0, 662, 12, 652, 3, 4, 0, 752, 0, 753], ["+", 0, 662, 12, 652, 3, 4, 0, 752, 0, 753]]
4
70
import math def main(): while True: n = int(input()) if n == 0: break else: data = list(map(float, input().split())) avg = sum(data) / n print(avg) square = 0 for i in range(n): square += data[i]**2 ...
import math def main(): while True: n = int(input()) if n == 0: break else: data = list(map(float, input().split())) avg = sum(data) / n square = 0 for i in range(n): square += data[i]**2 print(math.sqrt...
[["-", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
101
daviations = [] while True: num = int(input()) if num == 0: break scores = input().split() for i in range(num): scores[i] = float(scores[i]) avr = sum(scores) / num daviation = 0 for a in scores: disp = (a - avr)**2/num daviation +=...
import math daviations = [] while True: num = int(input()) if num == 0: break scores = input().split() for i in range(num): scores[i] = float(scores[i]) avr = sum(scores) / num daviation = 0 for a in scores: disp = (a - avr)**2/num ...
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
105
from math import * while True: n = int(input()) if(n == 0 ): break data = list(map(int,input().split())) a = sum(data) / n b = 0 c = 0 for i in data: b += pow(i-a,2) c = sqrt(b/2) print(c)
from math import * while True: n = int(input()) if(n == 0 ): break data = list(map(int,input().split())) a = sum(data) / n b = 0 c = 0 for i in data: b += pow(i-a,2) c = sqrt(b/n) print(c)
[["-", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 22]]
5
81
import statistics while True: n = input() if n == '0': break print(statistics.stdev(map(int, input().split())))
import statistics while True: n = input() if n == '0': break print(statistics.pstdev(map(int, input().split())))
[["-", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22]]
5
38
import math while 1: n=int(input()) if n == 0: break ss=list(map(float,input().split())) a=sum(ss)/n s=(sum([ (s-a)**2 for s in ss ]) / n)**0.5 print(a) print('{0:.6f}'.format(s))
import math while 1: n=int(input()) if n == 0: break ss=list(map(float,input().split())) a=sum(ss)/n s=(sum([ (s-a)**2 for s in ss ]) / n)**0.5 print('{0:.6f}'.format(s))
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 52, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24]]
5
83
import math while True: n = int(input()) if n==0: break s = list(map(float, raw_input().split())) t = sum(s) a = t / n b = sum(map(lambda x: (x-a)**2, s)) print(math.sqrt(b/n))
import math while True: n = int(input()) if n==0: break s = list(map(float, input().split())) t = sum(s) a = t / n b = sum(map(lambda x: (x-a)**2, s)) print(math.sqrt(b/n))
[["-", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22], ["+", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22]]
5
78
import math while True: n = input() if n == "0": break else: score = list(map(float, input().split())) m = sum(score)/len(score) for i in range(len(score)): score[i] = (score[i]-m)**2 answer = math.sqrt(sum(score)/len(socre)) print(answer)
import math while True: n = input() if n == "0": break else: score = list(map(float, input().split())) m = sum(score)/len(score) for i in range(len(score)): score[i] = (score[i]-m)**2 answer = math.sqrt(sum(score)/len(score)) print(answer)
[["-", 3, 4, 0, 657, 12, 652, 3, 4, 0, 22], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 22]]
5
94
import math while True: n = eval(input()) if n == 0: break m = list(map(float,input().split())) print("5f" %(math.sqrt(sum([(m[i]-(sum(m)/len(m)))**2 for i in range(n)])/n)))
import math while True: n = eval(input()) if n == 0: break m = list(map(float,input().split())) print("%5f" %(math.sqrt(sum([(m[i]-(sum(m)/len(m)))**2 for i in range(n)])/n)))
[["-", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6]]
5
84
import statistics data=[] while True: n=eval(input()) if n==0:break data.append(list(map(int,input().split()))) Data=iter(data) for i in Data: print(statistics.stdev(i))
import statistics data=[] while True: n=eval(input()) if n==0:break data.append(list(map(int,input().split()))) Data=iter(data) for i in Data: print(statistics.pstdev(i))
[["-", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22]]
5
63
import statistics while input() != "0": data = list(map(float, input().split())) ("{0:.6f}".format(statistics.pstdev(data)))
import statistics while input() != "0": data = list(map(float, input().split())) print("{0:.6f}".format(statistics.pstdev(data)))
[["+", 0, 52, 8, 196, 0, 1, 0, 652, 63, 22]]
5
43
while 1: if int(input())==0:break n=set(map(int,input().split())) b=len(n) a=sum(n)/b print((sum((x-a)**2 for x in n)/b)**0.5)
while 1: if int(input())==0:break n=list(map(int,input().split())) b=len(n) a=sum(n)/b print((sum((x-a)**2 for x in n)/b)**0.5)
[["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22]]
5
68
scores = [] while True: n = int(input()) if n == 0: break l = list(map(int, input().split())) scores.append(l) for score in scores: print(pstdev(score))
from statistics import pstdev scores = [] while True: n = int(input()) if n == 0: break l = list(map(int, input().split())) scores.append(l) for score in scores: print(pstdev(score))
[["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 314], ["+", 36, 36, 0, 656, 0, 686, 687, 673, 0, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 487], ["+", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22]]
5
56
import statistics while True: x = input() if x == 0: break else: ls = list(map(int, input().split())) print("{0:.8f}".format(statistics.pstdev(ls)))
import statistics while True: x = int(input()) if x == 0: break else: ls = list(map(int, input().split())) print("{0:.8f}".format(statistics.pstdev(ls)))
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
51
import statistics while True: s=int(input()) if s==0: break else: lst=list(map(int,input().split())) print("{0:.8}".format(statitics.pstdev(lst)))
import statistics while True: s=int(input()) if s==0: break else: lst=list(map(int,input().split())) print("{0:.8}".format(statistics.pstdev(lst)))
[["-", 0, 652, 3, 4, 0, 652, 63, 319, 500, 22], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 500, 22]]
5
54
from statistics import pstdev while True: if input() == 0: break v_list = (int(x) for x in input().split()) print(pstdev(v_list))
from statistics import pstdev while True: if input() == '0': break v_list = (int(x) for x in input().split()) print(pstdev(v_list))
[["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 655]]
5
40
while True: n = int( input() ) if n==0: break a=map(int, input().split()) m=sum(a) s=0 for i in a: s+=(i-m)**2 print( ( s/n)**0.5 )
while True: n = int( input() ) if n==0: break a=list(map(int, input().split())) m=sum(a)/n s=0 for i in a: s+=(i-m)**2 print( ( s/n)**0.5 )
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 85], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
64
while input()!='0': l=list(map(float,input().split())) m=sum(l)/len(l) s=0 for i in range(len(l)): s+=(l[i]-m)**2 print('%.8f'%(s/len(l)**.5))
while input()!='0': l=list(map(float,input().split())) m=sum(l)/len(l) s=0 for i in range(len(l)): s+=(l[i]-m)**2 print('%.8f'%((s/len(l))**.5))
[["+", 0, 657, 12, 23, 0, 657, 31, 23, 0, 24], ["+", 31, 23, 0, 657, 12, 652, 3, 4, 0, 25]]
5
80
import math while True: line = int(input()) if line == 0: break l = [float(s) for s in input().split()] avg = sum(l) / len(l) print(avg) a2 = 0 for i in l: a2 += (avg - i) ** 2 print(math.sqrt(a2 / len(l)))
import math while True: line = int(input()) if line == 0: break l = [float(s) for s in input().split()] avg = sum(l) / len(l) a2 = 0 for i in l: a2 += (avg - i) ** 2 print(math.sqrt(a2 / len(l)))
[["-", 0, 52, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
83
while input(): s=list(map(int,input().split())) n=len(s) a=sum(s)/n print((sum([x*x for x in s])/n-a*a)**.5)
while input()!='0': s=list(map(int,input().split())) n=len(s) a=sum(s)/n print((sum([x*x for x in s])/n-a*a)**.5)
[["+", 36, 36, 0, 656, 0, 52, 15, 666, 667, 79], ["+", 0, 656, 0, 52, 15, 666, 0, 557, 0, 654], ["+", 0, 656, 0, 52, 15, 666, 0, 557, 0, 6], ["+", 0, 656, 0, 52, 15, 666, 0, 557, 0, 655]]
5
61
while input(): s=list(map(int,input().split())) n=len(s) a=sum(s)/n print((sum([x*x for x in s])/n-a*a)**.5)
while int(input()): s=list(map(int,input().split())) n=len(s) a=sum(s)/n print((sum([x*x for x in s])/n-a*a)**.5)
[["+", 36, 36, 0, 656, 0, 52, 15, 652, 63, 22], ["+", 0, 656, 0, 52, 15, 652, 3, 4, 0, 24], ["+", 15, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
61
while input(): s=list(map(int,input().split())) n=len(s) a=sum(s)/n print((sum([x*x for x in s])/n-a*a)**.5)
while int(input()): s=list(map(int,input().split())) n=len(s) a=sum(s)/n print((sum(x*x for x in s)/n-a*a)**.5)
[["+", 36, 36, 0, 656, 0, 52, 15, 652, 63, 22], ["+", 0, 656, 0, 52, 15, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 52, 15, 652, 3, 4, 0, 25], ["-", 31, 657, 31, 652, 3, 4, 0, 658, 0, 70], ["-", 31, 657, 31, 652, 3, 4, 0, 658, 0, 73]]
5
61
from statistics import pstdev while True: data_count = int(input()) if data_count == 0: break print(pstdev(sum(int(x) for x in input().split())))
from statistics import pstdev while True: data_count = int(input()) if data_count == 0: break print(pstdev(int(x) for x in input().split()))
[["-", 3, 4, 0, 652, 3, 4, 0, 652, 63, 22], ["-", 0, 652, 3, 4, 0, 652, 3, 668, 0, 24], ["-", 3, 668, 0, 659, 12, 652, 3, 4, 0, 25]]
5
44
import math while(True): if input() == '0': break a = list(map(int, input().split())) m = sum(a) / len(a) b = 0 for i in a: b += (i - m) ** 2.0 stddev = math.sqrt(b / n) print(stddev)
import math while(True): if input() == '0': break a = list(map(int, input().split())) m = sum(a) / len(a) b = 0 for i in a: b += (i - m) ** 2.0 stddev = math.sqrt(b / len(a)) print(stddev)
[["-", 0, 662, 12, 652, 3, 4, 0, 657, 12, 22], ["+", 12, 652, 3, 4, 0, 657, 12, 652, 63, 22], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 22], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 25]]
5
76
import math while True: n = int(input()) if n == 0: break s = list(map(int, input().split())) ave = sum(s) / n S = [] for i in range(n): key = ave - s[i] S.append(key * key) print('{:.5f}'.format(math.sqrt(int(sum(S) / n))))
import math while True: n = int(input()) if n == 0: break s = list(map(int, input().split())) ave = sum(s) / n S = [] for i in range(n): key = ave - s[i] S.append(key * key) print('{:.5f}'.format(math.sqrt(sum(S) / n)))
[["-", 3, 4, 0, 652, 3, 4, 0, 652, 63, 22], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
96
# -*- coding: utf-8 -*- import math while True: n = int(input()) if n == 0: break s = list(map(float, input().split())) mean = sum(s) / len(s) for i in range(len(s)): s[i] = (s[i] - sum) * (s[i] - sum) variance = sum(s) / len(s) stdev = math.sqrt(variance) print(st...
# -*- coding: utf-8 -*- import math while True: n = int(input()) if n == 0: break s = list(map(float, input().split())) mean = sum(s) / len(s) for i in range(len(s)): s[i] = (s[i] - mean) * (s[i] - mean) variance = sum(s) / len(s) stdev = math.sqrt(variance) print(...
[["-", 0, 662, 12, 657, 31, 23, 0, 657, 12, 22], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 12, 22], ["-", 0, 662, 12, 657, 12, 23, 0, 657, 12, 22], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 22]]
5
104
import math while True: n = int(input()) if n == 0: break s = [int(e) for e in input().split()] average = sum(s) // n total = 0 for e in s: total += (e - average)**2 # 偏差の2乗の合計 print("{0: .4f}".format(math.sqrt(total//n)))
import math while True: n = int(input()) if n == 0: break s = [int(e) for e in input().split()] average = sum(s) / n total = 0 for e in s: total += (e - average)**2 # 偏差の2乗の合計 print("{0: .4f}".format(math.sqrt(total/n)))
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 676], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 85], ["-", 3, 4, 0, 652, 3, 4, 0, 657, 17, 676], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 85]]
5
81
import math result = [] n = int(input()) while n != 0: d = list(map(int, input().split())) mean = sum(d) / n var = [(i - mean) ** 2 for i in d] var = math.sqrt(sum(var) / n) result.append(var) n = int(input()) print(result)
import math result = [] n = int(input()) while n != 0: d = list(map(int, input().split())) mean = sum(d) / n var = [(i - mean) ** 2 for i in d] var = math.sqrt(sum(var) / n) result.append(var) n = int(input()) for i in result: print(i)
[["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 267], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 102], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
90
#!/usr/bin/env python3 # coding: utf-8 class Dice() : rightlist = ((-1,3,1,4,2,-1), (2,-1,5,0,-1,3), (4,0,-1,-1,5,2), (1,5,-1,-1,0,4), (3,-1,0,5,-1,2), (-1,2,4,1,3,-1)) def __init__(self, data): self.label = data ...
#!/usr/bin/env python3 # coding: utf-8 class Dice() : rightlist = ((-1,3,1,4,2,-1), (2,-1,5,0,-1,3), (4,0,-1,-1,5,1), (1,5,-1,-1,0,4), (3,-1,0,5,-1,2), (-1,2,4,1,3,-1)) def __init__(self, data): self.label = data ...
[["-", 0, 1, 0, 662, 12, 660, 0, 660, 0, 612], ["+", 0, 1, 0, 662, 12, 660, 0, 660, 0, 612]]
5
258
IDX_TABLE=\ {1:[4,2,3,5], 2:[1,4,6,3], 3:[1,2,6,5], 4:[1,5,6,2], 5:[1,4,6,3], 6:[3,2,4,5]} nums = ["dummy"] + [int(x) for x in input().split(" ")] n = int(input()) for i in range(n): up, front = tuple([int(x) for x in input().split(" ")]) up_idx = nums.index(up) front_idx = nums.index(front) ring...
IDX_TABLE=\ {1:[4,2,3,5], 2:[1,4,6,3], 3:[1,2,6,5], 4:[1,5,6,2], 5:[4,1,3,6], 6:[3,2,4,5]} nums = ["dummy"] + [int(x) for x in input().split(" ")] n = int(input()) for i in range(n): up, front = tuple([int(x) for x in input().split(" ")]) up_idx = nums.index(up) front_idx = nums.index(front) ring...
[["-", 0, 662, 12, 680, 0, 569, 51, 634, 0, 612], ["-", 0, 662, 12, 680, 0, 569, 51, 634, 0, 21], ["+", 0, 662, 12, 680, 0, 569, 51, 634, 0, 612], ["+", 0, 662, 12, 680, 0, 569, 51, 634, 0, 21]]
5
191
# coding=utf-8 class Dice(object): def __init__(self, label): self.label = label def _rotateS(self): s1, s2, s3, s4, s5, s6 = self.label self.label = [s5, s1, s3, s4, s6, s2] def _rotateN(self): s1, s2, s3, s4, s5, s6 = self.label self.label = [s2, s6, s3, s4, s1...
# coding=utf-8 class Dice(object): def __init__(self, label): self.label = label def _rotateS(self): s1, s2, s3, s4, s5, s6 = self.label self.label = [s5, s1, s3, s4, s6, s2] def _rotateN(self): s1, s2, s3, s4, s5, s6 = self.label self.label = [s2, s6, s3, s4, s1...
[["-", 8, 196, 0, 1, 0, 662, 12, 634, 0, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 634, 0, 22]]
5
543
class Dice: def __init__(self, num_list): self.faces = num_list def find_rf(self, top, front): tf = str(self.faces.index(top)) + str(self.faces.index(front)) if tf in '12431': return self.faces[0] elif tf in '03520': return self.faces[1] elif tf i...
class Dice: def __init__(self, num_list): self.faces = num_list def find_rf(self, top, front): tf = str(self.faces.index(top)) + str(self.faces.index(front)) if tf in '12431': return self.faces[0] elif tf in '03520': return self.faces[1] elif tf i...
[["-", 0, 57, 75, 665, 15, 666, 0, 557, 0, 6], ["+", 0, 57, 75, 665, 15, 666, 0, 557, 0, 6]]
5
199
class Dice(object): def __init__(self, top, south, east, west, north, bottom): self.top = top self.south = south self.east = east self.west = west self.north = north self.bottom = bottom def get_face(self, face): if face == 'top': return self....
class Dice(object): def __init__(self, top, south, east, west, north, bottom): self.top = top self.south = south self.east = east self.west = west self.north = north self.bottom = bottom def get_face(self, face): if face == 'top': return self....
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
430
class dice: def __init__(self,label): self.d = label def roll(self,op): d = self.d if op=='N': self.d = [d[1],d[5],d[2],d[3],d[0],d[4]] elif op=='E': self.d = [d[3],d[1],d[0],d[5],d[4],d[2]] elif op=='W': self.d = [d[2],d[1],d[5],d[0],d[4],d[3]] elif op=='S': se...
class dice: def __init__(self,label): self.d = label def roll(self,op): d = self.d if op=='N': self.d = [d[1],d[5],d[2],d[3],d[0],d[4]] elif op=='E': self.d = [d[3],d[1],d[0],d[5],d[4],d[2]] elif op=='W': self.d = [d[2],d[1],d[5],d[0],d[4],d[3]] elif op=='S': se...
[["-", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612]]
5
917
# coding: utf-8 # ?????????????????¨???????????? class Dice(object): def __init__(self): # ???????????????????????° # ????????¶??? self.dice = (2, 5), (3, 4), (1, 6) # x, y, z self.ax = [[0, False], [1, False], [2, False]] self.axmap = [0, 1, 2] self.mm = {"N": (0, 2), "S": (2, 0), "E": (1, 2), "W": (2, 1)...
# coding: utf-8 # ?????????????????¨???????????? class Dice(object): def __init__(self): # ???????????????????????° # ????????¶??? self.dice = (2, 5), (3, 4), (1, 6) # x, y, z self.ax = [[0, False], [1, False], [2, False]] self.axmap = [0, 1, 2] self.mm = {"N": (0, 2), "S": (2, 0), "E": (1, 2), "W": (2, 1)...
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 0, 70], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 0, 73]]
5
480
# coding: utf-8 # ?????????????????¨???????????? class Dice(object): def __init__(self): # ????????¶??? self.dice = (2, 5), (3, 4), (1, 6) # x, y, z self.ax = [[0, False], [1, False], [2, False]] self.axmap = [0, 1, 2] self.mm = {"N": (0, 2), "S": (2, 0), "E": (1, 2), "W": (2, 1), "R": (0, 1), "L": (1, 0)} ...
# coding: utf-8 # ?????????????????¨???????????? class Dice(object): def __init__(self): # ????????¶??? self.dice = (2, 5), (3, 4), (1, 6) # x, y, z self.ax = [[0, False], [1, False], [2, False]] self.axmap = [0, 1, 2] self.mm = {"N": (0, 2), "S": (2, 0), "E": (1, 2), "W": (2, 1), "R": (0, 1), "L": (1, 0)} ...
[["-", 0, 656, 0, 682, 8, 196, 0, 14, 141, 22], ["+", 0, 656, 0, 682, 8, 196, 0, 14, 141, 22]]
5
502
rot = ((1,2,4,3),(2,0,3,5),(0,1,5,4)) f = input().split() for i in range(int(input())): t, s = map(f.index, input().split()) for j in rot: if (t in j)*(s in j): continue d = rot.index(j) if (j.index(t) - j.index(s)) %4 == 1: d -= 5 print(f[abs(d)])
R = ((1,2,4,3),(2,0,3,5),(0,1,5,4)) f = input().split() for i in range(int(input())): t, s = map(f.index, input().split()) for j in R: if not (t in j)*(s in j): continue d = R.index(j) if (j.index(t) - j.index(s)) %4 == 1: d -= 5 print(f[abs(d)])
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 0, 656, 0, 7, 8, 196, 0, 7, 12, 22], ["+", 0, 656, 0, 7, 8, 196, 0, 7, 12, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 681, 0, 372], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22]]
5
134
class Dice(): def __init__(self, label): self.d = label def roll(self, drt): if drt == 'N': self.d[1], self.d[2], self.d[6], self.d[5] = self.d[2], self.d[6], self.d[5], self.d[1] elif drt == 'E': self.d[1], self.d[3], self.d[6], self.d[4] = self.d[4], self.d[1], self.d[3], self.d[6] elif drt == 'S': ...
class Dice(): def __init__(self, label): self.d = label def roll(self, drt): if drt == 'N': self.d[1], self.d[2], self.d[6], self.d[5] = self.d[2], self.d[6], self.d[5], self.d[1] elif drt == 'E': self.d[1], self.d[3], self.d[6], self.d[4] = self.d[4], self.d[1], self.d[3], self.d[6] elif drt == 'S': ...
[["-", 0, 1, 0, 652, 3, 4, 0, 206, 206, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 22]]
5
487
class Dice: def __init__(self): self.front = '1' self.back = '6' self.top = '5' self.bottom = '2' self. right = '3' self.left = '4' def turnRight(self): temp = self.top self.top = self.left self.left = self.bottom self.bottom = self...
class Dice: def __init__(self): self.front = '1' self.back = '6' self.top = '5' self.bottom = '2' self. right = '3' self.left = '4' def turnRight(self): temp = self.top self.top = self.left self.left = self.bottom self.bottom = self...
[["-", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22]]
5
335
d=input().split() for _ in range(int(input())): t,f=[d.index(s) for s in input().split()] n={0:(1,2,4,3,1),1:(0,3,5,2,0),2:(0,1,5,4,0),3:(1,0,4,5,1),4:(0,2,5,3,0),5:(1,3,4,2,1)}[int(t)] print(n[n.index(int(f))+1]+1)
d=input().split() for _ in range(int(input())): t,f=[d.index(s) for s in input().split()] n={0:(1,2,4,3,1),1:(0,3,5,2,0),2:(0,1,5,4,0),3:(1,0,4,5,1),4:(0,2,5,3,0),5:(1,3,4,2,1)}[int(t)] print(d[n[n.index(int(f))+1]])
[["+", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 0, 70], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 0, 73]]
5
156
def north(list): List = [] List.append(list[1]) List.append(list[5]) List.append(list[2]) List.append(list[3]) List.append(list[0]) List.append(list[4]) return List def west(list): List = [] List.append(list[2]) List.append(list[1]) List.append(list[5]) List.append(l...
def north(list): List = [] List.append(list[1]) List.append(list[5]) List.append(list[2]) List.append(list[3]) List.append(list[0]) List.append(list[4]) return List def west(list): List = [] List.append(list[2]) List.append(list[1]) List.append(list[5]) List.append(l...
[["+", 0, 206, 206, 657, 31, 657, 12, 657, 31, 612], ["+", 0, 206, 206, 657, 31, 657, 12, 657, 17, 48], ["+", 0, 206, 206, 657, 31, 657, 12, 657, 12, 22], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 17, 72]]
5
464
"use strict"; main(require("fs") .readFileSync("/dev/stdin", "utf8") .replace(/\r?\n$/, "") .split(/\r?\n/)); function main(lines) { function Dice(labels) { this.t = labels[0]; this.s = labels[1]; this.e = labels[2]; this.w = labels[3]; this.n = labels[4]; this.b = ...
"use strict"; main(require("fs") .readFileSync("/dev/stdin", "utf8") .replace(/\r?\n$/, "") .split(/\r?\n/)); function main(lines) { function Dice(labels) { this.t = labels[0]; this.s = labels[1]; this.e = labels[2]; this.w = labels[3]; this.n = labels[4]; this.b = ...
[["+", 0, 200, 51, 350, 3, 3, 0, 516, 0, 70], ["+", 0, 200, 51, 350, 3, 3, 0, 516, 0, 73]]
2
538
import java.io.*; import java.math.*; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.nextLine(); int one = Integer.parseInt(s.split(" ")[0]), two = Int...
import java.io.*; import java.math.*; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.nextLine(); int one = Integer.parseInt(s.split(" ")[0]), two = Int...
[["-", 8, 196, 0, 1, 0, 11, 12, 5, 0, 491], ["+", 8, 196, 0, 1, 0, 11, 12, 5, 0, 491]]
3
538
#include <iostream> #include <string> using namespace std; class DICE { private: const int dice_tem[5][6] = { {3, 2, 6, 1, 5, 4}, {2, 6, 3, 4, 1, 5}, {5, 1, 3, 4, 6, 2}, {4, 2, 1, 6, 5, 3}, {1, 2, 3, 4, 5, 6}}; //{0}:W {1}:N {2}:S {3}:E {4}:defalut const string dice_rl = "AWWWNWWWNWWW...
#include <iostream> #include <string> using namespace std; class DICE { private: const int dice_tem[5][6] = { {3, 2, 6, 1, 5, 4}, {2, 6, 3, 4, 1, 5}, {5, 1, 3, 4, 6, 2}, {4, 2, 1, 6, 5, 3}, {1, 2, 3, 4, 5, 6}}; //{0}:W {1}:N {2}:S {3}:E {4}:defalut const string dice_rl = "AWWWNWWWNWWW...
[["-", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 147], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
475
#include <algorithm> #include <iostream> #define REP(i, a, b) for (i = a; i < b; i++) #define rep(i, n) REP(i, 0, n) using namespace std; class Dice { private: int tmp; public: int lab[6]; void rE() { tmp = lab[0]; lab[0] = lab[3]; lab[3] = lab[5]; lab[5] = lab[2]; lab[2] = tmp; } void...
#include <algorithm> #include <iostream> #define REP(i, a, b) for (i = a; i < b; i++) #define rep(i, n) REP(i, 0, n) using namespace std; class Dice { private: int tmp; public: int lab[6]; void rE() { tmp = lab[0]; lab[0] = lab[3]; lab[3] = lab[5]; lab[5] = lab[2]; lab[2] = tmp; } void...
[["+", 8, 123, 0, 14, 8, 9, 0, 9, 0, 45], ["+", 8, 123, 0, 14, 8, 9, 0, 9, 0, 46]]
1
572
#include <algorithm> #include <cctype> #include <cmath> #include <iostream> #include <list> #include <map> #include <string> #include <utility> #include <vector> using namespace std; enum FACE { TOP, BACK, RIGHT, LEFT, FRONT, BOTTOM }; template <class T> class dice { public: dice() { id[TOP] = 0; id[FRONT] =...
#include <algorithm> #include <cctype> #include <cmath> #include <iostream> #include <list> #include <map> #include <string> #include <utility> #include <vector> using namespace std; enum FACE { TOP, BACK, RIGHT, LEFT, FRONT, BOTTOM }; template <class T> class dice { public: dice() { id[TOP] = 0; id[FRONT] =...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
631
#include <iostream> #include <limits.h> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; void north(int *faces) { int tmp[7]; // top(1) to back(5) tmp[5] = faces[1]; // front(2) to top(1) tmp[1] = faces[2]; // right(3) to right(3) tmp[3] = faces[3]; //...
#include <iostream> #include <limits.h> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; void north(int *faces) { int tmp[7]; // top(1) to back(5) tmp[5] = faces[1]; // front(2) to top(1) tmp[1] = faces[2]; // right(3) to right(3) tmp[3] = faces[3]; //...
[["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 146], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 147]]
1
563
#include <iostream> #include <string> using namespace std; class Dice { public: static const int SURFACE_NUM = 6; // ?????????????????¢??° static const int DIR_NUM = 4; // ?????¢?????????????????° static const int ROUND_NUM = 4; // ?????¢????????¢?????° enum DIR { N, W, S, E }; // ?????¢?????? ...
#include <iostream> #include <string> using namespace std; class Dice { public: static const int SURFACE_NUM = 6; // ?????????????????¢??° static const int DIR_NUM = 4; // ?????¢?????????????????° static const int ROUND_NUM = 4; // ?????¢????????¢?????° enum DIR { N, W, S, E }; // ?????¢?????? ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
718
#include <iostream> using namespace std; struct Dice { int top; int north; int east; int south; int west; int bottom; }; void rotn(Dice &d); void rote(Dice &d); // void rots(Dice& d); // void rotw(Dice& d); void rotc(Dice &d); bool judge(Dice &d1, Dice &d2); Dice d1, d2; int tmp; bool flag = false; int ...
#include <iostream> using namespace std; struct Dice { int top; int north; int east; int south; int west; int bottom; }; void rotn(Dice &d); void rote(Dice &d); // void rots(Dice& d); // void rotw(Dice& d); void rotc(Dice &d); bool judge(Dice &d1, Dice &d2); Dice d1, d2; int tmp; bool flag = false; int ...
[["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
532
#include <iostream> using namespace std; class Dice { public: int n1, n2, n3, n4, n5, n6; void East() { int t = n1; n1 = n4; n4 = n6; n6 = n3; n3 = t; } void West() { int t = n1; n1 = n3; n3 = n6; n6 = n4; n4 = t; } void South() { int t = n1; n1 = n5; n5 ...
#include <iostream> using namespace std; class Dice { public: int n1, n2, n3, n4, n5, n6; void East() { int t = n1; n1 = n4; n4 = n6; n6 = n3; n3 = t; } void West() { int t = n1; n1 = n3; n3 = n6; n6 = n4; n4 = t; } void South() { int t = n1; n1 = n5; n5 ...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 64, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
393
#include <iostream> using namespace std; #include <string> class dice { public: int F[6]; dice(); void roll_a(); void roll_b(); bool check(const dice &d); }; dice::dice() { for (int i = 0; i < 6; i++) cin >> F[i]; } void dice::roll_a() { static int i, j; i = F[0]; F[0] = F[2]; F[2] = F[1]; ...
#include <iostream> using namespace std; #include <string> class dice { public: int F[6]; dice(); void roll_a(); void roll_b(); bool check(const dice &d); }; dice::dice() { for (int i = 0; i < 6; i++) cin >> F[i]; } void dice::roll_a() { static int i, j; i = F[0]; F[0] = F[2]; F[2] = F[1]; ...
[["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22]]
1
523
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) #define repb(i, a, b) for (int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define int long long using namespace std; // ITPC dice3 class dice { public: int top, bottom, right, left, front, back; void North(); void East(); voi...
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) #define repb(i, a, b) for (int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define int long long using namespace std; // ITPC dice3 class dice { public: int top, bottom, right, left, front, back; void North(); void East(); voi...
[["-", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6], ["+", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6]]
1
471
#include <iostream> using namespace std; class dice { public: int d[7]; int set(); int E(); int W(); int N(); int S(); int R(); //?°´???????????¢ int C(int *, int *, int *, int *); //??\?????????????????? }; int dice::set() { for (int i = 1; i <= 6; i++) { cin >> d[i]; ...
#include <iostream> using namespace std; class dice { public: int d[7]; int set(); int E(); int W(); int N(); int S(); int R(); //?°´???????????¢ int C(int *, int *, int *, int *); //??\?????????????????? }; int dice::set() { for (int i = 1; i <= 6; i++) { cin >> d[i]; ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
590
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <random> #include <vector> using namespace std; #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) #define For(i, a, b) for (int(i) = (a); (i) < (b); (i)++) class Dice { vector<int> v; public: Dice(int a, int b, int c, int d, ...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <random> #include <vector> using namespace std; #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) #define For(i, a, b) for (int(i) = (a); (i) < (b); (i)++) class Dice { vector<int> v; public: Dice(int a, int b, int c, int d, ...
[["-", 0, 11, 12, 16, 31, 69, 341, 342, 0, 22], ["+", 0, 11, 12, 16, 31, 69, 341, 342, 0, 22], ["-", 0, 11, 12, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 11, 12, 16, 12, 69, 341, 342, 0, 22]]
1
822
#include <iostream> using namespace std; class Cube { public: int f[6]; Cube() {} void roll_x() { roll(0, 1, 5, 4); } void roll_y() { roll(0, 2, 5, 3); } void roll_z() { roll(1, 2, 4, 3); } void roll(int i, int j, int k, int l) { int t = f[i]; f[i] = f[j]; f[j] = f[k]; f[k] = f[l]; f[l]...
#include <iostream> using namespace std; class Cube { public: int f[6]; Cube() {} void roll_x() { roll(0, 1, 5, 4); } void roll_y() { roll(0, 2, 5, 3); } void roll_z() { roll(1, 2, 4, 3); } void roll(int i, int j, int k, int l) { int t = f[i]; f[i] = f[j]; f[j] = f[k]; f[k] = f[l]; f[l]...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
354
#include <iostream> using namespace std; int d1[6], d2[6]; void _n() { int tmp = d2[0]; d2[0] = d2[1]; d2[1] = d2[5]; d2[5] = d2[4]; d2[4] = tmp; } void _s() { int tmp = d2[0]; d2[0] = d2[4]; d2[4] = d2[5]; d2[5] = d2[1]; d2[1] = tmp; } void _e() { int tmp = d2[0]; d2[0] = d2[3]; d2[3] = d2[5]...
#include <iostream> using namespace std; int d1[6], d2[6]; void _n() { int tmp = d2[0]; d2[0] = d2[1]; d2[1] = d2[5]; d2[5] = d2[4]; d2[4] = tmp; } void _s() { int tmp = d2[0]; d2[0] = d2[4]; d2[4] = d2[5]; d2[5] = d2[1]; d2[1] = tmp; } void _e() { int tmp = d2[0]; d2[0] = d2[3]; d2[3] = d2[5]...
[["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 46]]
1
752
#include <bits/stdc++.h> using namespace std; struct cww { cww() { ios::sync_with_stdio(false); cin.tie(0); } } star; #define P(x) cout << (x) << endl #define p(x) cout << (x) #define all(c) (c).begin(), (c).end() #define rall(c) (c).rbegin(), (c).rend() #define vv(type, c, m, n, i) vector<vector<type>> c(m...
#include <bits/stdc++.h> using namespace std; struct cww { cww() { ios::sync_with_stdio(false); cin.tie(0); } } star; #define P(x) cout << (x) << endl #define p(x) cout << (x) #define all(c) (c).begin(), (c).end() #define rall(c) (c).rbegin(), (c).rend() #define vv(type, c, m, n, i) vector<vector<type>> c(m...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
587
//???????????£?¨? class Dice { public: Dice(int top, int front, int right, int left, int back, int bottom); //?????????????????????(?????°??????) int get_top(); int get_front(); int get_right(); int get_left(); int get_back(); int get_bottom(); bool roll_topfront(int top, int front); void roll...
//???????????£?¨? class Dice { public: Dice(int top, int front, int right, int left, int back, int bottom); //?????????????????????(?????°??????) int get_top(); int get_front(); int get_right(); int get_left(); int get_back(); int get_bottom(); bool roll_topfront(int top, int front); void roll...
[["-", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6], ["+", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6]]
1
1,151
#include <iostream> #include <string> using namespace std; class dice { public: int d[7]; dice() { //?????????????????????????????? } void east() { d[0] = d[1], d[1] = d[4], d[4] = d[6], d[6] = d[3], d[3] = d[0]; } void north() { d[0] = d[5], d[5] = d[1], d[1] = d[2], d[2] = d[6], d[6] = d[0]; ...
#include <iostream> #include <string> using namespace std; class dice { public: int d[7]; dice() { //?????????????????????????????? } void east() { d[0] = d[1], d[1] = d[4], d[4] = d[6], d[6] = d[3], d[3] = d[0]; } void north() { d[0] = d[5], d[5] = d[1], d[1] = d[2], d[2] = d[6], d[6] = d[0]; ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
434
#include <iostream> using namespace std; void moveE(int dice[6]) { int tmp = dice[0]; dice[0] = dice[3]; dice[3] = dice[5]; dice[5] = dice[2]; dice[2] = tmp; } void moveN(int dice[6]) { int tmp = dice[0]; dice[0] = dice[1]; dice[1] = dice[5]; dice[5] = dice[4]; dice[4] = tmp; } void moveS(int dice[6...
#include <iostream> using namespace std; void moveE(int dice[6]) { int tmp = dice[0]; dice[0] = dice[3]; dice[3] = dice[5]; dice[5] = dice[2]; dice[2] = tmp; } void moveN(int dice[6]) { int tmp = dice[0]; dice[0] = dice[1]; dice[1] = dice[5]; dice[5] = dice[4]; dice[4] = tmp; } void moveS(int dice[6...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
525
#include <stdio.h> #include <string.h> #define rep(i, n) for (int i = 0; i < n; ++i) class dice { private: int f[6]; public: dice(int *a) { int i; rep(i, 6) f[i] = a[i]; } void n() { int t; t = f[0]; f[0] = f[1]; f[1] = f[5]; f[5] = f[4]; f[4] = t; } void s() { int t; ...
#include <stdio.h> #include <string.h> #define rep(i, n) for (int i = 0; i < n; ++i) class dice { private: int f[6]; public: dice(int *a) { int i; rep(i, 6) f[i] = a[i]; } void n() { int t; t = f[0]; f[0] = f[1]; f[1] = f[5]; f[5] = f[4]; f[4] = t; } void s() { int t; ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95]]
1
710
#include <iostream> #include <string> using namespace std; class Dice { // ---------- // | S[0] | // | | // | | // | | // -------------------------------------------- // | S[3] | S[1] | S[2] | S[4] ...
#include <iostream> #include <string> using namespace std; class Dice { // ---------- // | S[0] | // | | // | | // | | // -------------------------------------------- // | S[3] | S[1] | S[2] | S[4] ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
884
class Dice TOP=0 FRONT=1 RIGHT=2 LEFT=3 BACK=4 BOTTOM=5 def initialize( nums ) @face = nums end def rolltoTopIndex( faceindex ) case faceindex when FRONT roll( "N" ) when RIGHT roll( "W" ) when LEFT roll( "E" ) when BACK roll( "S" ) when BOTTOM roll( "NN" ) when TOP end en...
class Dice TOP=0 FRONT=1 RIGHT=2 LEFT=3 BACK=4 BOTTOM=5 def initialize( nums ) @face = nums end def rolltoTopIndex( faceindex ) case faceindex when FRONT roll( "N" ) when RIGHT roll( "W" ) when LEFT roll( "E" ) when BACK roll( "S" ) when BOTTOM roll( "NN" ) when TOP end en...
[["-", 0, 88, 51, 267, 0, 739, 0, 475, 17, 389], ["+", 0, 88, 51, 267, 0, 739, 0, 475, 17, 757]]
4
528
class Dice def initialize(given_ary) @ary = given_ary end def topface(val) 4.times do self.roll ("E") if self.top == val return end end 3.times do self.roll("N") if self.top == val return end end end def frontface(val) 4.times do ...
class Dice def initialize( given_ary ) @ary = given_ary end def topface( val ) 4.times do self.roll( "E" ) if self.top == val return end end 3.times do self.roll( "N" ) if self.top == val return end end end def frontface( val ) 4.t...
[["-", 8, 736, 0, 738, 31, 652, 196, 196, 0, 45], ["+", 8, 736, 0, 738, 31, 652, 3, 4, 0, 24], ["-", 8, 736, 0, 738, 31, 652, 196, 196, 0, 46], ["+", 8, 736, 0, 738, 31, 652, 3, 4, 0, 25], ["-", 0, 662, 12, 652, 3, 4, 0, 652, 17, 131]]
4
623
class Dice attr_accessor :status def initialize(status) @status = status end def compareSpec(dice) @d2 = dice.status d1 = matchDirect(@d2) return (d1 == @d2) ? true : false end def matchDirect(d2) dt = Array.new(6) 2.times do |i| idx = detectIndex(i) dt[i] = @status[idx...
class Dice attr_accessor :status def initialize(status) @status = status end def compareSpec(dice) @d2 = dice.status d1 = matchDirect(@d2) return (d1 == @d2) ? true : false end def matchDirect(d2) dt = Array.new(6) 2.times do |i| idx = detectIndex(i) dt[i] = @status[idx...
[["-", 0, 735, 8, 736, 0, 38, 0, 4, 0, 612], ["+", 0, 735, 8, 736, 0, 38, 0, 4, 0, 22]]
4
465
#!/usr/bin/env python3 # coding: utf-8 import random class Dice() : mask = {'N':(1,5,2,3,0,4), 'E':(3,1,0,5,4,2), 'W':(2,1,5,0,4,3), 'S':(4,0,2,3,5,1)} way = ("N","E","W","S") def __init__(self, data): self.label = data def move(self, data): self.label = [self.label[idx]...
#!/usr/bin/env python3 # coding: utf-8 import random class Dice() : mask = {'N':(1,5,2,3,0,4), 'E':(3,1,0,5,4,2), 'W':(2,1,5,0,4,3), 'S':(4,0,2,3,5,1)} way = ("N","E","W","S") def __init__(self, data): self.label = data def move(self, data): self.label = [self.label[idx]...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
285
class Dice: def __init__(self): self.faces=[] def rotate(self, direction): tmp = self.faces.copy() if direction =="N": self.faces[5-1] = tmp[1-1] self.faces[1-1] = tmp[2-1] self.faces[2-1] = tmp[6-1] self.faces[6-1] = tmp[5-1] if ...
class Dice: def __init__(self): self.faces=[] def rotate(self, direction): tmp = self.faces.copy() if direction =="N": self.faces[5-1] = tmp[1-1] self.faces[1-1] = tmp[2-1] self.faces[2-1] = tmp[6-1] self.faces[6-1] = tmp[5-1] if ...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 79], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60]]
5
527