#include <iostream> #include <vector> using namespace std; class uczestnik { int T[11] = {}, sum = 0; public: void input() { for (int i = 0; i < 18; i ++) { int a; cin>>a; sum += a; T[a] ++; } } int count(int a){return T[a];} int suma(){return sum;} }; uczestnik A, B; void win(int t){ if (t == 1) cout<<"Algosia"; if (t == 2) cout<<"Bajtek"; exit(0); } int main() { A.input(); B.input(); if (A.suma() > B.suma()) win(1); if (A.suma() < B.suma()) win(2); for (int i = 10; i > 0; i --){ if (A.count(i) > B.count(i)) win(1); if (A.count(i) < B.count(i)) win(2); } cout<<"remis"; }
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 | #include <iostream> #include <vector> using namespace std; class uczestnik { int T[11] = {}, sum = 0; public: void input() { for (int i = 0; i < 18; i ++) { int a; cin>>a; sum += a; T[a] ++; } } int count(int a){return T[a];} int suma(){return sum;} }; uczestnik A, B; void win(int t){ if (t == 1) cout<<"Algosia"; if (t == 2) cout<<"Bajtek"; exit(0); } int main() { A.input(); B.input(); if (A.suma() > B.suma()) win(1); if (A.suma() < B.suma()) win(2); for (int i = 10; i > 0; i --){ if (A.count(i) > B.count(i)) win(1); if (A.count(i) < B.count(i)) win(2); } cout<<"remis"; } |