源代码:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
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;
}