2016女生赛 1001 Solving Order

来源:互联网 发布:下载电驴软件 编辑:程序博客网 时间:2024/04/28 02:53

Solving Order

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


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
33red 1green 2yellow 31blue 832red 2white 1
 

Sample Output
yellow green redbluered white
 


#include<iostream>#include<stdio.h>#include<cmath>#include<string.h>#include<queue>using namespace std;struct s{ char name[20];int num;friend bool operator < (s a,s b){return a.num<b.num;}};int main(){int t ,n,i;priority_queue<s>q;s s1;while(cin>>t){while(t--){cin>>n;for(i=0;i<n;i++){cin>>s1.name>>s1.num;q.push(s1);}while(q.size()>1){s1=q.top();cout<<s1.name<<' ';    q.pop();}    s1=q.top();cout<<s1.name<<endl;q.pop();}}return 0;}


0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 针对初中不听话的学生怎么办 初中一年级成绩太差怎么办 新牙长出来乳牙没掉怎么办 小孩乳牙没掉就长出新牙怎么办 复读一年还考大专怎么办 宝贝刚上幼儿园哭怎么办 新入幼儿园宝贝老是哭怎么办 孩子不太会说话幼儿园不要怎么办 幼儿上台表演害羞胆怯怎么办 小学转学学校不接收怎么办 在校读书的留守儿童怎么办 足球比赛中裁判碰到球怎么办 花盆的土变硬板结怎么办 lol皮肤不想要了怎么办 泉州小黄人自行车被偷怎么办 小学数学没学好上初中怎么办 50天的宝宝缺钙怎么办 5个月的宝宝缺钙怎么办 空调接电后指示灯不亮怎么办 欧普led灯坏了怎么办 led灯条芯片坏了怎么办 太阳能板只有电压没有电流怎么办 农村按空调房屋不保温怎么办 自己一个人想去足疗店不敢去怎么办 吊灯led灯坏了怎么办 办健身卡老板携款跑路了怎么办 武安丰尚健身怎么办卡 热敷后眼睛肿了怎么办 两眼视力差距大怎么办 怀孕体重长得快怎么办 怀孕初期发胖6斤怎么办 孕早期长得太快怎么办 怀孕了肚子眼脏怎么办 孕38周孩子偏小怎么办 孕初期胖的厉害怎么办 怀孕干活累着了怎么办 怀孕了上班很累怎么办 孕妇胖的太快怎么办 孕妇长得太快怎么办 眼睛一按吱吱响怎么办 孕期太胖了怎么办啊