#include <algorithm> #include <cstdio> #include <functional> #include <vector> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define PB push_back #define ALL(c) (c).begin(),(c).end() #define INT(x) int x; scanf("%d", &x) typedef vector<int> VI; VI p[2]; int main() { REP(i,2) { int s = 0; REP(j,18) { INT(x); p[i].PB(x); s += x; } p[i].PB(s); sort(ALL(p[i]), greater<int>()); } if (p[0] > p[1]) printf("Algosia\n"); else if (p[0] < p[1]) printf("Bajtek\n"); else printf("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 | #include <algorithm> #include <cstdio> #include <functional> #include <vector> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define PB push_back #define ALL(c) (c).begin(),(c).end() #define INT(x) int x; scanf("%d", &x) typedef vector<int> VI; VI p[2]; int main() { REP(i,2) { int s = 0; REP(j,18) { INT(x); p[i].PB(x); s += x; } p[i].PB(s); sort(ALL(p[i]), greater<int>()); } if (p[0] > p[1]) printf("Algosia\n"); else if (p[0] < p[1]) printf("Bajtek\n"); else printf("remis\n"); } |