#10 求助
  • 板块CF2A Winner
  • 楼主_HHJ
  • 当前回复1
  • 已保存回复1
  • 发布时间2022/9/5 09:26
  • 上次更新2023/10/27 12:29:50
查看原帖
#10 求助
600112
_HHJ楼主2022/9/5 09:26

#include <iostream>
#include <map>
#include <set>
#include <string>
using namespace std;
map<string,long long>a;
set<string>ak;
long long  n;
int main()
{
    cin >> n;
    string name,kkk;
    long long  score,res = -(1e9);
    for(int i = 1 ; i <= n ; i ++ )
    {
        cin >> name >> score;
        ak.insert(name);
        a[name] += score;
        if(a[name] > res)
            res = a[name],
            kkk = name;
    }
    for (auto i:ak){
       if(a[i] > res)
       res = a[i],
       kkk = i;
    }
    cout << kkk << endl;
    return 0;
    
}
2022/9/5 09:26
加载中...