题目
代码
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int teamNum;
int personNum;
int score;
int total;
cin >> total;
int team[1001] = { 0 };
int i;
for (i = 0; i < total; i++)
{
scanf("%d-%d %d", &teamNum, &personNum, &score);
team[teamNum] += score;
}
int maxScore = 0, maxNum;
for (i = 0; i < 1001; i++)
{
if (team[i] > maxScore)
{
maxNum = i;
maxScore = team[i];
}
}
cout << maxNum << ' ' << maxScore << endl;
system("pause");
return 0;
}