/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
using namespace std;
int tab1[19], tab2[19], suma1, suma2, a;
bool b;
int main()
{
for(int i = 0; i < 18; i++){
cin >> a;
tab1[a]++;
suma1+=a;
}
for(int i = 0; i < 18; i++){
cin >> a;
tab2[a]++;
suma2+=a;
}
if(suma1>suma2){
cout << "Algosia";
}
else if (suma1<suma2){
cout << "Bajtek";
}
else{
for(int i = 18; i >= 0; i--){
if(tab1[i]>tab2[i]){
cout << "Algosia";
b=1;
break;
}
else if (tab2[i]>tab1[i]){
cout << "Bajtek";
b=1;
break;
}
}
if(b==0){
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 47 48 49 50 51 52 53 54 55 | /****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> using namespace std; int tab1[19], tab2[19], suma1, suma2, a; bool b; int main() { for(int i = 0; i < 18; i++){ cin >> a; tab1[a]++; suma1+=a; } for(int i = 0; i < 18; i++){ cin >> a; tab2[a]++; suma2+=a; } if(suma1>suma2){ cout << "Algosia"; } else if (suma1<suma2){ cout << "Bajtek"; } else{ for(int i = 18; i >= 0; i--){ if(tab1[i]>tab2[i]){ cout << "Algosia"; b=1; break; } else if (tab2[i]>tab1[i]){ cout << "Bajtek"; b=1; break; } } if(b==0){ cout << "remis"; } } return 0; } |
English