#include <iostream>
using namespace std;
int B[18], A[18], sa, sb, zlicza[11], zliczb[11];
bool a, b;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
a=b=false;
for (int i=0; i<18; i++)
{
cin >> A[i];
sa=sa+A[i];
zlicza[A[i]]++;
}
for (int i=0; i<18; i++)
{
cin >> B[i];
sb=sb+B[i];
zliczb[B[i]]++;
}
if (sa>sb) a=true;
else if (sa<sb) b=true;
else
{
for (int i=10; i>0; i--)
{
if (zlicza[i]>zliczb[i])
{
a=true;
break;
}
if (zlicza[i]<zliczb[i])
{
b=true;
break;
}
}
}
if (a==true) cout << "Algosia";
else if (b==true) cout << "Bajtek";
else if (a==b) cout << "remis";
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 37 38 39 40 41 42 43 44 45 46 | #include <iostream> using namespace std; int B[18], A[18], sa, sb, zlicza[11], zliczb[11]; bool a, b; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); a=b=false; for (int i=0; i<18; i++) { cin >> A[i]; sa=sa+A[i]; zlicza[A[i]]++; } for (int i=0; i<18; i++) { cin >> B[i]; sb=sb+B[i]; zliczb[B[i]]++; } if (sa>sb) a=true; else if (sa<sb) b=true; else { for (int i=10; i>0; i--) { if (zlicza[i]>zliczb[i]) { a=true; break; } if (zlicza[i]<zliczb[i]) { b=true; break; } } } if (a==true) cout << "Algosia"; else if (b==true) cout << "Bajtek"; else if (a==b) cout << "remis"; return 0; } |
English