您的位置:首页 > 其它

1032. 挖掘机技术哪家强(20)

2017-11-12 21:57 232 查看

原题: https://www.patest.cn/contests/pat-b-practise/1032

思路: 开个100K+的数组, 轻松搞定.

完整实现:

#include <stdio.h>

int main (void) {
int n;
int stu[100001] = {0};
int no;
int score;
int maxNo;
int maxScore = 0;
int i;

scanf("%d", &n);
for (i=1; i<=n; i++) {
scanf("%d %d", &no, &score);
stu[no] += score;
if (stu[no] > maxScore) {
maxScore = stu[no];
maxNo = no;
}
}
printf("%d %d\n", maxNo, maxScore);

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: