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

1032 挖掘机技术哪家强 (20 分)_第1张图片
源代码:
#include
#include
#include

int main()
{
int n;
scanf("%d",&n);
int schoolGoal[100001];
memset(schoolGoal,0,sizeof(schoolGoal));
int maxSchool=1,sumMax = 0;
while(n–){
int school,goal;
scanf("%d%d",&school,&goal);
schoolGoal[school] += goal;
if(schoolGoal[school] > sumMax){
maxSchool = school;
sumMax = schoolGoal[school];
}
}
printf("%d %d",maxSchool,sumMax);
return 0;
}

你可能感兴趣的:(PTA刷题记录)