题解
2025-11-08 20:36:28
发布于:广东
1阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
struct photos{
string g;
double t;
bool f;
}
a[50];
bool cmp(photos a,photos b){
if(a.f!=b.f)
return a.f>b.f;
else if(a.f1&&b.f1)
return a.t<b.t;
else
return a.t>b.t;
}
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i].g>>a[i].t;
if(a[i].g=="male")
a[i].f=1;
else
a[i].f=0;
}
sort(a,a+n,cmp);
for(int i=0;i<n;i++)
printf("%.2f ",a[i].t);
return 0;
}
这里空空如也







有帮助,赞一个