标签:hid school i++ const can return 打印 scan std
#include<cstdio>
const int maxx= 100010;
int school[maxx]={0};
int main()
{
int n,schid,schscore;
scanf("%d",&n);
for(int i=0;i<n;i++)//获取学校分数存入数组
{
scanf("%d%d",&schid,&schscore);
school[schid]+=schscore;
}
//找出最高分打印
int k=0;
for(int i=0;i<=n;i++)
{
if(school[k]<school[i])
k=i;
}
printf("%d %d\n",k,school[k]);
return 0;
}
标签:hid school i++ const can return 打印 scan std
原文地址:https://www.cnblogs.com/hebust/p/9498064.html