1032 挖掘机技术哪家强
程序员文章站
2024-03-18 23:29:46
...
题目传送门
分析:每个编号一个总分,使用vector
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> a(n + 1);
int num, score;
for (int i = 1; i <= n; i++)
{
cin >> num >> score;
a[num] += score;
}
int max = a[1], t = 1;
for (int i = 2; i <= n; i++)
{
if (a[i] > max)
{
max = a[i];
t = i;
}
}
cout << t << " " << max;
return 0;
}
上一篇: 1032 挖掘机技术哪家强