#include <bits/stdc++.h> using namespace std; typedef vector<int> VI; typedef pair <int,int> ii; typedef long long LL; #define pb push_back const int INF = 2147483647; const int N = 3005; int sumA, sumB, tab[20], bat[20], i; int main() { for (i=0;i<18;i++) { scanf("%d", &tab[i]); sumA += tab[i]; } for (i=0;i<18;i++) { scanf("%d", &bat[i]); sumB += bat[i]; } if (sumA > sumB) printf("Algosia\n"); else if (sumB > sumA) printf("Bajtek\n"); else { sort(tab, tab + 18); sort(bat, bat + 18); for (i=17;i>=0;i--) { if (tab[i] > bat[i]) { printf("Algosia\n"); return 0; } else if (bat[i] > tab[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 28 29 30 31 32 33 34 35 36 | #include <bits/stdc++.h> using namespace std; typedef vector<int> VI; typedef pair <int,int> ii; typedef long long LL; #define pb push_back const int INF = 2147483647; const int N = 3005; int sumA, sumB, tab[20], bat[20], i; int main() { for (i=0;i<18;i++) { scanf("%d", &tab[i]); sumA += tab[i]; } for (i=0;i<18;i++) { scanf("%d", &bat[i]); sumB += bat[i]; } if (sumA > sumB) printf("Algosia\n"); else if (sumB > sumA) printf("Bajtek\n"); else { sort(tab, tab + 18); sort(bat, bat + 18); for (i=17;i>=0;i--) { if (tab[i] > bat[i]) { printf("Algosia\n"); return 0; } else if (bat[i] > tab[i]) { printf("Bajtek\n"); return 0; } } printf("remis\n"); } return 0; } |