#include <cstdio> int main() { int in[36]; for (int i = 0; i < 36; i++) scanf("%d", &in[i]); int a[11], b[11]; for (int i = 0; i < 11; i++) a[i] = 0; for (int i = 0; i < 11; i++) b[i] = 0; for (int i = 0; i < 18; i++) a[0] += in[i]; for (int i = 18; i < 36; i++) b[0] += in[i]; for (int i = 1; i < 11; i++) { for (int j = 0; j < 18; j++) a[i] += (in[j] == (11 - i)); for (int j = 18; j < 36; j++) b[i] += (in[j] == (11 - i)); } for (int i = 0; i < 11; i++) { if (a[i] > b[i]) printf("Algosia\n"); if (a[i] < b[i]) printf("Bajtek\n"); if (a[i] != b[i]) return 0; } printf("remis\n"); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include <cstdio> int main() { int in[36]; for (int i = 0; i < 36; i++) scanf("%d", &in[i]); int a[11], b[11]; for (int i = 0; i < 11; i++) a[i] = 0; for (int i = 0; i < 11; i++) b[i] = 0; for (int i = 0; i < 18; i++) a[0] += in[i]; for (int i = 18; i < 36; i++) b[0] += in[i]; for (int i = 1; i < 11; i++) { for (int j = 0; j < 18; j++) a[i] += (in[j] == (11 - i)); for (int j = 18; j < 36; j++) b[i] += (in[j] == (11 - i)); } for (int i = 0; i < 11; i++) { if (a[i] > b[i]) printf("Algosia\n"); if (a[i] < b[i]) printf("Bajtek\n"); if (a[i] != b[i]) return 0; } printf("remis\n"); return 0; } |