"巴卡斯杯" 中国大学生程序设计竞赛 - 女生专场(重现) HDU 5702

Solving Order

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 9    Accepted Submission(s): 9


Problem Description
Welcome to HDU to take part in the first CCPC girls' competition!



As a pretty special competition, many volunteers are preparing for it with high enthusiasm.
One thing they need to do is blowing the balloons.

Before sitting down and starting the competition, you have just passed by the room where the boys are blowing the balloons. And you have found that the number of balloons of different colors are strictly different.

After thinking about the volunteer boys' sincere facial expressions, you noticed that, the problem with more balloon numbers are sure to be easier to solve.

Now, you have recalled how many balloons are there of each color.
Please output the solving order you need to choose in order to finish the problems from easy to hard.
You should print the colors to represent the problems.
 

Input
The first line is an integer T which indicates the case number.
And as for each case, the first line is an integer n , which is the number of problems.
Then there are n lines followed, with a string and an integer in each line, in the i -th line, the string means the color of ballon for the i -th problem, and the integer means the ballon numbers.

It is guaranteed that:
T is about 100.
1n10 .
1 string length 10 .
1 bolloon numbers 83 .(there are 83 teams :p)
For any two problems, their corresponding colors are different.
For any two kinds of balloons, their numbers are different.
 

Output
For each case, you need to output a single line.
There should be n strings in the line representing the solving order you choose.
Please make sure that there is only a blank between every two strings, and there is no extra blank.
 

Sample Input
  
  
3 3 red 1 green 2 yellow 3 1 blue 83 2 red 2 white 1
 

Sample Output
  
  
yellow green red blue red white
 

Source
 

Recommend
liuyiding   |   We have carefully selected several similar problems for you:   5711  5710  5709  5708  5700 

水题,结构体排序


#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstdio>
using namespace std;
//void printf(int begin,int end,int mid)
//{
//    int i;
//    if(begin>end)
//        return;
//    for(i=begin; i<=end; i++)
//        if(b[i]==a[mid])
//            break;
//    printf(begin,i-1,mid+1);  //中序,先左,后跟,再右。此时i为跟节点,左子树必定在begin到i-1里面。
//    printf(i+1,end,mid-begin+i+1);//中序,先左,后跟,再右。此时i为跟节点,右子树必定在i+1到end里面。
//    cout<<a[mid];
//    if(mid==1)
//        cout<<endl;
//    else
//        cout<<" ";
//}
struct node
{
   int id;
   char s[1000];
};
bool cmp(node a,node b)
{
    return a.id>b.id;
}
int main()
{
     int t;
     scanf("%d",&t);
     while(t--)
     {
         node f[1000];
         int n;
         cin>>n;
         int i;
         for(i=0;i<n;i++)
         cin>>f[i].s>>f[i].id;
         sort(f,f+n,cmp);
           for(i=0;i<n;i++)
              i==0?cout<<f[i].s:cout<<" "<<f[i].s;
              cout<<endl;
     }
}


 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值