Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
319414 黄浙峰老师 【C5-9】合影效果 C++ 通过 100 1 MS 252 KB 436 2025-04-26 14:48:18

Tests(10/10):


#include<iostream> #include<string> #include<algorithm> #include<iomanip> using namespace std; struct stu{ string s; double h; }a[42]; bool cmp(stu x,stu 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=0;i<n;i++) cin>>a[i].s>>a[i].h; sort(a,a+n,cmp); for(int i=0;i<n;i++) cout<<fixed<<setprecision(2)<<a[i].h<<" "; return 0; }


测评信息: