#include <iostream>
using namespace std;
// Function that compares two integers
bool compare(int a, int b)
{
if (a > b)
{
std::cout << "Algosia" << std::endl;
return true;
} else if (a < b)
{
std::cout << "Bajtek" << std::endl;
return true;
}
return false;
}
int main(int argc, char const *argv[])
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
// Declare table with 12 elements
int a[12];
int b[12];
int current_value = 0;
// Fill tables with 0
int i;
for (i = 0; i < 12; i++)
{
a[i] = 0;
b[i] = 0;
}
// Read input
for (i = 0; i < 18; i++)
{
std::cin >> current_value;
a[11] += current_value;
a[current_value]++;
}
for (i = 0; i < 18; i++)
{
std::cin >> current_value;
b[11] += current_value;
b[current_value]++;
}
for (i = 11; i >= 0; i--)
{
if (compare(a[i], b[i]))
{
return 0;
}
}
std::cout << "remis" << std::endl;
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 56 57 58 59 60 61 62 63 64 65 | #include <iostream> using namespace std; // Function that compares two integers bool compare(int a, int b) { if (a > b) { std::cout << "Algosia" << std::endl; return true; } else if (a < b) { std::cout << "Bajtek" << std::endl; return true; } return false; } int main(int argc, char const *argv[]) { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); // Declare table with 12 elements int a[12]; int b[12]; int current_value = 0; // Fill tables with 0 int i; for (i = 0; i < 12; i++) { a[i] = 0; b[i] = 0; } // Read input for (i = 0; i < 18; i++) { std::cin >> current_value; a[11] += current_value; a[current_value]++; } for (i = 0; i < 18; i++) { std::cin >> current_value; b[11] += current_value; b[current_value]++; } for (i = 11; i >= 0; i--) { if (compare(a[i], b[i])) { return 0; } } std::cout << "remis" << std::endl; return 0; } |
English