#include<bits/stdc++.h>
using namespace std;
int x[11][2];
int main()
{
int a=0, b=0;
for(int j=0; j<2; j++)
{
for(int i=0; i<18; i++)
{
int r;
cin >> r;
x[r][j]++;
if(j==0)
{a=a+r;}
else
{b=b+r;}
}
}
if(a>b)
{cout << "Algosia";}
else if(b>a)
{cout << "Bajtek";}
else
{
int u=10;
while((u>0)&&(x[u][0]==x[u][1]))
{u--;}
if(x[u][0]>x[u][1])
{cout << "Algosia";}
else if(x[u][1]>x[u][0])
{cout << "Bajtek";}
else
{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<bits/stdc++.h> using namespace std; int x[11][2]; int main() { int a=0, b=0; for(int j=0; j<2; j++) { for(int i=0; i<18; i++) { int r; cin >> r; x[r][j]++; if(j==0) {a=a+r;} else {b=b+r;} } } if(a>b) {cout << "Algosia";} else if(b>a) {cout << "Bajtek";} else { int u=10; while((u>0)&&(x[u][0]==x[u][1])) {u--;} if(x[u][0]>x[u][1]) {cout << "Algosia";} else if(x[u][1]>x[u][0]) {cout << "Bajtek";} else {cout << "remis";} } } |
English