02:输出最高分数的学生姓名
作者:
恰我年少时 | 来源:发表于
2022-05-06 13:20 被阅读0次#include <iostream>
#include <map>
using namespace std;
int main() {
int n;
cin>>n;
map<int,string> S_score;
for(int i=0;i<n;i++){
int score;
string name;
cin>>score>>name;
S_score.insert(pair<int,string>(score,name));
}
int max = 0;
for(map<int,string>::iterator it = S_score.begin();it!=S_score.end();it++)
max = max>it->first?max:it->first;
cout<<S_score[max];
return 0;
}
本文标题:02:输出最高分数的学生姓名
本文链接:https://www.haomeiwen.com/subject/klzayrtx.html
网友评论