通过了居然是红色的字体,真有点不习惯,
按题意就行了
#include<iostream>
#include<algorithm>
using namespace std;
struct Student{
char name[20];
char xuehao[20];
int score;
};
struct Student s[100];
int n;
bool cmp(Student a,Student b)
{
return a.score>b.score;
}
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>s[i].name>>s[i].xuehao>>s[i].score;
}
sort(s+1,s+n+1,cmp);
cout<<s[1].name<<" "<<s[1].xuehao<<endl;
cout<<s[n].name<<" "<<s[n].xuehao<<endl;
}