文章
94
粉丝
0
获赞
455
访问
14.8k
#include <bits/stdc++.h>
using namespace std;
struct Student{
string name;
int score;
};
bool cmp(Student a ,Student b){
return a.score < b.score;
}
bool cmps(Student a ,Student b){
return a.score > b.score;
}
int main()
{
int num,order;
while(cin >> num >> order){
vector<Student> stu;
for(int i = 0; i < num; i++){
string name;
int score;
cin >> name >> score;
stu.push_back({name, score});
}
if(order){
stable_sort(stu.begin(),stu.end(),cmp);
}else{
&...
登录后发布评论
暂无评论,来抢沙发