文章
81
粉丝
0
获赞
282
访问
11.0k
#include<bits/stdc++.h>
using namespace std;
struct student{
int co;
int score;
}stu[1000];
bool cmp(student a,student b){
if(a.score==b.score)
{return a.co < b.co;
}
else {
return a.score < b.score;
}
}
int main(){
int n,i;
cin>>n;
for(i=0;i<n;i++){
cin>>stu[i].co>>stu[i].score;
}
sort(stu,stu+n,cmp);
for(i=0;i<n;i++){
cout<<stu[i].co<<" "<<stu[i].score<<endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发