Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
61144 | 孙诗皓 | 朋友信息 | C++ | Accepted | 1 MS | 260 KB | 641 | 2023-12-02 16:21:54 |
#include<iostream> #include<cstring> #include<algorithm> using namespace std; struct fd{ string name; int birth; long long number; }b[20]; bool cmp(fd x,fd y){ if(x.birth!=y.birth) return x.birth<y.birth; else if(x.name!=y.name) return x.name<y.name; else return x.number<y.number; } int main(){ int n; cin>>n; for(int i=0;i<n;i++) { cin>>b[i].name>>b[i].birth>>b[i].number; } sort(b,b+n,cmp); for(int y=0;y<n;y++) { cout<<b[y].name<<' '<<b[y].birth<<' '<<b[y].number<<endl; } return 0; }