Official

B - Scoreboard Editorial by en_translator Editorial for printing


For beginners

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: