B - Solving Order HDU - 5702
作者:互联网
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<cmath>
#include<complex>
#include<string>
#include<algorithm>
#include<iostream>
using namespace std;
const int M = 15;
struct balloon
{
char color[M];
int number;
}s[M];
bool cmp(balloon x,balloon y)
{
return x.number>y.number;
}
int main()
{
int t,n,i;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s%d",s[i].color,&s[i].number);
sort(s,s+n,cmp);
for(i=0;i<n;i++)
printf("%s%c",s[i].color,i!=n-1?' ':'\n');
}
return 0;
}
标签:HDU,int,balloon,Solving,number,5702,include,Order 来源: https://blog.csdn.net/qq_41895253/article/details/99889019