#include <iostream> using namespace std; int TOTALSUM_IDX = 11; int results[2][12]; // results[x][11] = total score of X int main() { for (int i = 0; i < 2; ++i) { for (int j = 0; j < 18; ++j) { int x; scanf("%d", &x); results[i][x]++; results[i][TOTALSUM_IDX] += x; } } for (int i = TOTALSUM_IDX; i >= 0; --i) { if (results[0][i] > results[1][i]) { printf("Algosia\n"); return 0; } else if (results[0][i] < results[1][i]) { printf("Bajtek\n"); 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 24 25 26 27 | #include <iostream> using namespace std; int TOTALSUM_IDX = 11; int results[2][12]; // results[x][11] = total score of X int main() { for (int i = 0; i < 2; ++i) { for (int j = 0; j < 18; ++j) { int x; scanf("%d", &x); results[i][x]++; results[i][TOTALSUM_IDX] += x; } } for (int i = TOTALSUM_IDX; i >= 0; --i) { if (results[0][i] > results[1][i]) { printf("Algosia\n"); return 0; } else if (results[0][i] < results[1][i]) { printf("Bajtek\n"); return 0; } } printf("remis\n"); return 0; } |