文章
93
粉丝
56
获赞
289
访问
46.1k
#include <bits/stdc++.h>
using namespace std;
struct student
{
string str;
int score;
int age;
}stu[1005];
bool cmp(student a,student b)
{
if(a.score!=b.score)return a.score<b.score;
else if(a.str!=b.str)return a.str<b.str;
else return a.age<b.age;
}
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>stu[i].str>>stu[i].age>>stu[i].score;
}
stable_sort(stu,stu+n,cmp);
for(int i=0;i<n;i++)
{
cout<<stu[i].str<<" "<<stu[i].age<<" "<<stu[i].score<<endl;
}
return 0; &...
登录后发布评论
暂无评论,来抢沙发