Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
3308 | 吴奕希 | 朋友信息 | C++ | Accepted | 0 MS | 256 KB | 635 | 2024-05-05 12:00:32 |
# 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; }