Official
A - Scoreboard Editorial by en_translator
For beginners
- If you are new to learning programming and do not know where to start, please try Problem A "Welcome to AtCoder" from practice contest. There you can find a sample code for each language.
- Also, if you are not familiar with problems in programming contests, we recommend you to try some problems in "AtCoder Beginners Selection".
- 「C++入門 AtCoder Programming Guide for beginners (APG4b)」 is a C++ tutorial for competitive programmers. Sadly, this is only in Japanese too.
Find the sum of points that team Takahashi got, and that for team Aoki, and compare them to print the answer.
The following is sample code.
#include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int TakahashiScore = 0; // Total points of team Takahashi
int AokiScore = 0; // Total points of team Aoki
for (int i = 0; i < N; ++i) {
int X, Y;
cin >> X >> Y;
// Add scores to each team
TakahashiScore += X;
AokiScore += Y;
}
// Compare the total points to print the answer
if (TakahashiScore > AokiScore)
cout << "Takahashi" << endl;
else if (TakahashiScore > AokiScore)
cout << "Aoki" << endl;
else
cout << "Draw" << endl;
return 0;
}
N = int(input())
TakahashiScore = 0 # Total points of team Takahashi
AokiScore = 0 # Total points of team Aoki
for i in range(N):
X, Y = map(int, input().split())
# Add scores to each team
TakahashiScore += X
AokiScore += Y
# Compare the total points to print the answer
if TakahashiScore > AokiScore:
print('Takahashi')
elif TakahashiScore < AokiScore:
print('Aoki')
else:
print('Draw')
posted:
last update: