Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
3318 邓小龙 朋友信息 C++ Wrong Answer 0 MS 268 KB 635 2024-05-17 11:07:57

Tests(0/3):


Code:

# include<iostream> # include<algorithm> using namespace std; struct Friend{ string name; long long bth, tp, age; void input(){ cin>>name>>bth>>tp; age = 2024 - bth / 100; } void output(){ cout<<name<<" "<<bth<<" "<<tp<<endl; } }; bool cmp(Friend f1, Friend f2){ if(f1.age!=f2.age)return f1.age>f2.age; if(f1.name!=f2.name)return f1.name>f2.name; return f1.tp>f2.tp; } Friend fs[10]; int n; int main(){ cin>>n; for(int i = 0; i < n; i++)fs[i].input(); sort(fs, fs+n, cmp); for(int i = 0; i < n; i++)fs[i].output(); return 0; }


Run Info:

------Input------
4 lele 19990302 13685930581 lema 19990302 13592039485 Kity 20010912 1872749501 Joy 19990302 18792049590
------Answer-----
Joy 19990302 18792049590 lele 19990302 13685930581 lema 19990302 13592039485 Kity 20010912 1872749501
------Your output-----
lema 19990302 13592039485 lele 19990302 13685930581 Joy 19990302 18792049590 Kity 20010912 1872749501