#include <bits/stdc++.h> using std::cin, std::cout; void init_io() { cin.tie(nullptr); std::ios::sync_with_stdio(false); } constexpr int max_score = 10; constexpr int num_scores = 18; using Score = std::pair<int, std::array<int, max_score+1>>; Score read_score() { Score score = {}; for (int i = 0; i < num_scores; ++i) { int v; cin >> v; score.first += v; score.second[max_score - v] += 1; } return score; } int main() { init_io(); const Score algosia = read_score(); const Score bajtek = read_score(); if (algosia > bajtek) { cout << "Algosia\n"; } else if (algosia < bajtek) { cout << "Bajtek\n"; } else { cout << "remis\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 33 34 35 36 37 38 | #include <bits/stdc++.h> using std::cin, std::cout; void init_io() { cin.tie(nullptr); std::ios::sync_with_stdio(false); } constexpr int max_score = 10; constexpr int num_scores = 18; using Score = std::pair<int, std::array<int, max_score+1>>; Score read_score() { Score score = {}; for (int i = 0; i < num_scores; ++i) { int v; cin >> v; score.first += v; score.second[max_score - v] += 1; } return score; } int main() { init_io(); const Score algosia = read_score(); const Score bajtek = read_score(); if (algosia > bajtek) { cout << "Algosia\n"; } else if (algosia < bajtek) { cout << "Bajtek\n"; } else { cout << "remis\n"; } } |