关于#5测试点,
但是,Leslie在第42行输入,Xiebing在第53输入,所以,不是应该Leslie在Xiebing前输出吗?我曾想:可能要换一下顺序吧。所以就有了#6测试点。
关于#6测试点,
但是,Leslie还在第42行输入,Xiebing也还在第53输入,掉换完顺序后#5测试点到AC了,但#6测试点WA了。so,各位大牛们,这到底是怎么一般事情?
附上本人的代码(CPP)(码风不是太好)
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
struct stu{
string name;
short year=2021,day=32,month=13;
};
bool comp(stu*a,stu*b){
if((a->year)!=(b->year))return ((a->year)>(b->year));
if((a->month)!=(b->month))return ((a->month)>(b->month));
if((a->day)!=(b->day))return ((a->day)>(b->day));
return true;
}
void input(stu*s){
cin>>s->name;
short a,b,c;
scanf("%hd%hd%hd",&s->year,&s->month,&s->day);
}
void swap(stu*S,int a,int b){
stu k=S[a];
S[a]=S[b],S[b]=k;
}
int main (){
//freopen("D:\\a.out","w",stdout);
short N;
scanf("%hd",&N);
stu S[N];
for(short I=0;I<N;I++)input(S+I);
for(short I=0,K=N-1;I<N;I++){
for(short J=0;J<K;J++){
if(comp(S+J,S+J+1))swap(S,J,J+1);
}
}
for(short I=0;I<N;I++)cout<<S[I].name<<endl;
return 0;
}