提交代码:
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 #include <stdio.h> 2 3 //定义常量 宏定义(宏替换) 4 #define maxn 100010 5 6 int school[maxn]={0}; 7 8 int main(){ 9 10 int n,schID,score; 11 scanf("%d",&n); 12 int i; 13 for(i=0;i<n;i++){ 14 scanf("%d%d",&schID,&score); 15 school[schID]+=score; 16 } 17 int k=1,MAX=-1; 18 for(i=1;i<=n;i++) { 19 if(school[i]> MAX) { 20 MAX=school[i] ; 21 k=i; 22 } 23 } 24 printf("%d %d\n",k,MAX); 25 return 0; 26 }