pat1032:挖掘机技术哪家强

https://www.patest.cn/contests/pat-b-practise/1032

#include "stdio.h"

int main()
{
	int n, i, num, score, school[100000] = {0}, k, max = 0;
	scanf("%d", &n);
	for(i = 0; i < n; ++i)
	{
		scanf("%d %d", &num, &score);
		school[num-1] += score;
		if(max < school[num-1])
		{
			k = num;
			max = school[num-1];
		}
	}
	printf("%d %d\n", k, max);

	return 0;
}


你可能感兴趣的:(c,pat)