0
张百川
新手光能
新手光能
#include<bits/stdc++.h>
using namespace std;
struct xs{
string xb;
double high;
}a[100005];
bool cmp(double x,double y)
{
return x>y;
}
double b[100005],c[100005];
int main()
{
int n,d=1,e=1;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i].xb>>a[i].high;
if(a[i].xb=="female")
{
b[d]=a[i].high;
d++;
}
if(a[i].xb=="male")
{
c[e]=a[i].high;
e++;
}
}
sort(c+1,c+e+1);
sort(b+1,b+d+1,cmp);
for(int i=2;i<=e;i++)
{
cout<<c[i]<<" ";
}
for(int i=1;i<=d-1;i++)
{
cout<<b[i]<<" ";
}
return 0;
}
0分