#include <iostream> #define REP(x,n) for (int x=0;x<(n);++x) #define TASKS_SIZE 18 #define RESULT(x) {\ cout << x << endl;\ return 0;\ } #define SCORE(a,b) {\ if ((a)>(b)) \ RESULT("Algosia")\ else if ((a)<(b)) {\ RESULT("Bajtek")\ }\ } using namespace std; int algosia[11]; int bajtek[11]; int algosiaTotal = 0; int bajtekTotal = 0; int main() { int score; REP(x,TASKS_SIZE) { cin>>score; ++algosia[score]; algosiaTotal += score; } REP(x,TASKS_SIZE) { cin>>score; ++bajtek[score]; bajtekTotal += score; } SCORE(algosiaTotal, bajtekTotal); for(int x=10;x>0;--x) { SCORE(algosia[x], bajtek[x]); } RESULT("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 | #include <iostream> #define REP(x,n) for (int x=0;x<(n);++x) #define TASKS_SIZE 18 #define RESULT(x) {\ cout << x << endl;\ return 0;\ } #define SCORE(a,b) {\ if ((a)>(b)) \ RESULT("Algosia")\ else if ((a)<(b)) {\ RESULT("Bajtek")\ }\ } using namespace std; int algosia[11]; int bajtek[11]; int algosiaTotal = 0; int bajtekTotal = 0; int main() { int score; REP(x,TASKS_SIZE) { cin>>score; ++algosia[score]; algosiaTotal += score; } REP(x,TASKS_SIZE) { cin>>score; ++bajtek[score]; bajtekTotal += score; } SCORE(algosiaTotal, bajtekTotal); for(int x=10;x>0;--x) { SCORE(algosia[x], bajtek[x]); } RESULT("remis"); } |