#include <bits/stdc++.h> using namespace std; const int N = 18; const int MAX_GRADE = 10; int main() { vector<vector<int>> tab(2, vector<int>(MAX_GRADE + 1, 0)); vector<int> sum(2, 0); vector<string> anserws = {"Algosia", "Bajtek", "remis"}; for (int j = 0; j < 2; j++) { for (int i = 0; i < N; i++) { int grade; cin >> grade; tab[j][grade]++; sum[j] += grade; } } if (sum[0] != sum[1]) { cout << anserws[sum[0] < sum[1]] << "\n"; return 0; } for (int i = MAX_GRADE; i >= 0; i--) { if (tab[0][i] != tab[1][i]) { cout << anserws[tab[0][i] < tab[1][i]] << "\n"; return 0; } } cout << anserws[2] << "\n"; }
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 28 29 30 31 32 | #include <bits/stdc++.h> using namespace std; const int N = 18; const int MAX_GRADE = 10; int main() { vector<vector<int>> tab(2, vector<int>(MAX_GRADE + 1, 0)); vector<int> sum(2, 0); vector<string> anserws = {"Algosia", "Bajtek", "remis"}; for (int j = 0; j < 2; j++) { for (int i = 0; i < N; i++) { int grade; cin >> grade; tab[j][grade]++; sum[j] += grade; } } if (sum[0] != sum[1]) { cout << anserws[sum[0] < sum[1]] << "\n"; return 0; } for (int i = MAX_GRADE; i >= 0; i--) { if (tab[0][i] != tab[1][i]) { cout << anserws[tab[0][i] < tab[1][i]] << "\n"; return 0; } } cout << anserws[2] << "\n"; } |