文章
35
粉丝
134
获赞
55
访问
25.4k
#include <bits/stdc++.h>
using namespace std;
struct node{
int num;
int score;
};
int cmp(node n1,node n2){
if(n1.score==n2.score){
return n1.num<n2.num;
}
return n1.score<n2.score;
}
int main(){
int n;
while(cin>>n){
node arr[n];
for(int i=0;i<n;i++){
cin>>arr[i].num>>arr[i].score;
}
sort(arr,arr+n,cmp);
for(int i=0;i<n;i++){
cout<<arr[i].num<<" "<<arr[i].score<<endl;
}
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发