Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
34201 | 郑皓 | 朋友信息 | C++ | Accepted | 1 MS | 768 KB | 465 | 2022-08-02 10:29:05 |
#include<iostream> #include<algorithm> #include<string> using namespace std; struct student{ string s1,s2,s3; }a[15]; bool cmp(student x,student y){ if(x.s2!=y.s2) return x.s1<y.s2; if(x.s1!=y.s1) return x.s1<y.s1; return x.s3<y.s3; } int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i].s1>>a[i].s2>>a[i].s3; } sort(a+1,a+1+n,cmp); for(int i=1;i<=n;i++){ cout<<a[i].s1<<" "<<a[i].s2<<" "<<a[i].s3<<endl; } return 0; }