模拟 : 1032 挖掘机技术哪家强 (20 分)
作者:互联网
#include <stdio.h>
#include <math.h>
#include <string.h>
const int maxn=1e5+7;
int a[maxn];
int main()
{
int n;
scanf("%d",&n);
for(int i=0;i<n;i++){
int index,score;
scanf("%d %d",&index,&score);
a[index]+=score;
}
int max=0,k=0;
for(int i=1;i<=n;i++){//编号范围:1~N
if(a[i]>max){
max=a[i];k=i;
}
}
printf("%d %d\n",k,max);
return 0;
}
标签:20,int,max,maxn,挖掘机,1032,include 来源: https://blog.csdn.net/qq_42861250/article/details/95791886