Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
319792 | 钱凯 | 【C5-9】合影效果 | C++ | 解答错误 | 0 | 1 MS | 260 KB | 422 | 2025-05-01 21:21:35 |
#include <bits/stdc++.h> using namespace std; struct Pe{ string e; double h; }p[45]; bool cmp(Pe x,Pe y){ if(x.e!=y.e) return x.e>y.e; if(x.e=="male") return x.h<y.h; } int main (){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>p[i].e>>p[i].h; } sort(p+1,p+n+1,cmp); for(int i=1;i<=n;i++){ cout<<fixed<<setprecision(2)<<p[i].h<<" "; } return 0; }