文章
33
粉丝
78
获赞
3
访问
18.4k
#include <stdio.h>
#include <algorithm>
#include <iostream>
using namespace std;
struct student {
int num;
int grade;
}stu [1000];
bool asc(student a,student b){
if (a.grade == b.grade)
return a.num < b.num;
else
return a.grade < b.grade;
}
int main() {
int n;
cin >> n;
for (int i = 0;i < n;i++) {
cin >> stu[i].num >> stu[i].grade;
}
sort(stu,stu + n,asc);
for (int i = 0;i < n;i++) {
cout << stu[i].num << " " << stu[i].grade << endl;...
登录后发布评论
暂无评论,来抢沙发