文章
8
粉丝
0
获赞
73
访问
1.1k
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,type;//个数,排序方法
while(cin>>n>>type){
multimap<int,string> mmap;//key值可以相同
string a;//姓名
int b;//成绩
while(n--){
cin>>a>>b;
int k=(type==0) ? -b :b;
mmap.emplace(k,a);
}
for(auto &it:mmap)
cout<<it.second<<' '<<(type==0 ? -it.first:it.first)<<endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发