Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
47005 | 奚晨瑞 | 病人排队 | C++ | Accepted | 1 MS | 248 KB | 565 | 2024-05-10 15:50:50 |
#include<bits/stdc++.h> using namespace std; struct pat{ string ID; int age; }a[99]; bool cmp(pat a,pat b){ if(a.age>=60&&b.age<60){ return 1; } else if(a.age<60){ return 0; } else{ if(a.age>b.age){ return 1; } else{ return 0; } } } bool i[99]; int main() { int n; cin>>n; for(int i=0;i<n;i++){ cin>>a[i].ID>>a[i].age; } for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ if(cmp(a[j],a[i])==1){ swap(a[j],a[i]); } } } for(int i=0;i<n;i++){ cout<<a[i].ID<<endl; } return 0; }