Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
319815 | 陈信宇 | 【C5-9】合影效果 | C++ | 通过 | 100 | 2 MS | 260 KB | 437 | 2025-05-02 10:02:44 |
#include<bits/stdc++.h> using namespace std; struct pe{ double h; string s; }a[105]; bool cmp(pe x,pe y){ if(x.s!=y.s) return x.s>y.s; if(x.s=="male") return x.h<y.h; return x.h>y.h; } int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i].s>>a[i].h; } sort(a+1,a+n+1,cmp) ; for(int i=1;i<=n;i++){ cout<<fixed<<setprecision(2)<<a[i].h<<" "; } return 0; }