成绩统计——输出总分

题目名称:成绩统计——输出总分
题目描述:输入N个学生的姓名和语文、数学的得分,输出每位同学的总分。
输入描述:第1行,有一个整数N,N的范围是[1…100];下面有N行,每行一个姓名,2个整数。姓名由不超过10个的小写字母组成,整数范围是[0…100]。
输出描述:每个同学的总分成绩(默认总分没有相同情况)。

样例输入:
3
gaoxiang 78 96
wangxi 56 99
liujia 90 87
样例输出:
174
155
177

最后实在写不下去了T_T

#include <iostream>
#include <string>
#include <vector>
#include <tuple>
using namespace std;
int main()
{
    int n;
    vector<tuple<string, int, int>> grades;
    string name;
    int grade1, grade2;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> name >> grade1 >> grade2;
        grades.push_back({name, grade1, grade2});
    }
    for (const auto &[name, grade1, grade2] : grades)
        cout << grade1 + grade2 << '\n';
    return 0;
}
$ g++ -Wall -std=c++17 main.cpp
$ ./a.out
3
gaoxiang 78 96
wangxi 56 99
liujia 90 87
174
155
177
public static void main(String args[]) throws IOException {
    BufferedReader bf = new InputStreamReader(System.in));
    int n =  Integer.parseInt(bf.readLine());
    while (n -- > 0){
        String array[] = bf.readLine().split(" ");
        String name = array[0];
        int chineseScore = Integer.parseInt(array[1]);
        int mathScore = Integer.parseInt(array[2]);
        int total = chineseScore + mathScore;
        System.out.println(total);
    }
}