Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
319793 钱凯 【C5-9】合影效果 C++ 通过 100 1 MS 256 KB 443 2025-05-01 21:24:33

Tests(10/10):


#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; 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; }


测评信息: