#include <iostream>
using namespace std;
int t1[18], t2[18],a,b,tab1[11],tab2[11];
int main()
{
for(int i=0; i<18; i++)
{
cin>>t1[i];
}
for(int i=0; i<18; i++)
{
cin>>t2[i];
}
for(int i=0; i<18; i++)
{
a=a+t1[i];
tab1[t1[i]]++;
}
for(int i=0; i<18; i++)
{
b=b+t2[i];
tab2[t2[i]]++;
}
if(a<b)
cout<<"Bajtek";
if(b<a)
cout<<"Algosia";
if(a==b)
{
for(int i=10; i>=0; i--)
{
if(tab1[i]!=tab2[i])
{
if(tab1[i]<tab2[i])
cout<<"Bajtek";
else
cout<<"Algosia";
break;
}
if(i==0)
{
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 37 38 39 40 41 42 43 44 45 46 | #include <iostream> using namespace std; int t1[18], t2[18],a,b,tab1[11],tab2[11]; int main() { for(int i=0; i<18; i++) { cin>>t1[i]; } for(int i=0; i<18; i++) { cin>>t2[i]; } for(int i=0; i<18; i++) { a=a+t1[i]; tab1[t1[i]]++; } for(int i=0; i<18; i++) { b=b+t2[i]; tab2[t2[i]]++; } if(a<b) cout<<"Bajtek"; if(b<a) cout<<"Algosia"; if(a==b) { for(int i=10; i>=0; i--) { if(tab1[i]!=tab2[i]) { if(tab1[i]<tab2[i]) cout<<"Bajtek"; else cout<<"Algosia"; break; } if(i==0) { cout<<"remis"; } } } } |
English