为啥全RE了

P1104 生日

@[hyh0174](/user/439949) string不能直接用scanf,printf ```cpp #include<cstdio> #include<algorithm> #include<string> #include<iostream> using namespace std; struct stu { string s; int y,m,d,o; }sb[110]; bool cmp(stu a,stu b) { if(a.y!=b.y) return a.y<b.y?true:false; else if(a.m!=b.m) return a.m<b.m?true:false; else if(a.d!=b.d) return a.d<b.d?true:false; else return a.o>b.o?true:false; } int main() { int n; scanf("%d",&n); for(int i=0;i<n;i++) { cin>>sb[i].s; scanf("%d %d %d",&sb[i].y,&sb[i].m,&sb[i].d); sb[i].o=i+1; } stable_sort(sb,sb+n,cmp); for(int i=0;i<n;i++) cout<<sb[i].s<<endl; //or printf("%s\n",sb[i].s.c_str()); return 0; } ``` 这样就A了
by hispy @ 2023-12-04 21:27:30


@[hispy](/user/376342) 好好好
by hyh0174 @ 2023-12-04 21:28:28


|