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

#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

int main()
{
	int n;
	cin >> n;
	int res[100001] = {0};
	for (int i = 0; i < n; i++)
	{
		int num,score;
		cin >> num>>score;
		res[num] =res[num]+ score;
	}
	int max = 0,index=0;
	for (int i = 0; i < 100001; i++)
	{
		if (res[i] > max)
		{
			index = i;
			max = res[i];
		}
	}
	cout << index << " " << res[index];
	system("pause");
	return 0;
}
上一篇:[LeetCode] 1032. Stream of Characters 字符流


下一篇:行业报告归档 2019.2.8