一、题目大意
二、解题思路
- 散列的简单题啦。
三、参考代码
#include<cstdio>
using namespace std;
int team[1005] = { 0 };
int main() {
int n;
scanf("%d", &n);
int t, p, s;
for (int i = 0; i < n; i++) {
scanf("%d-%d %d", &t, &p, &s);
team[t] += s;
}
int cur = 0;
for (int i = 0; i < 1005; i++)
if (team[i] > team[cur])
cur = i;
printf("%d %d\n", cur, team[cur]);
return 0;
}
四、解题感悟
-
越来越能感受到编程的乐趣了,加油!