"巴卡斯杯" 中国大学生程序设计竞赛 - 女生专场(重现) HDU 5702_solving order welcome to hdu to take part in the f-程序员宅基地

技术标签: HDU 水题  ACM算法  

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;
     }
}


 
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/sky_miange/article/details/51526924

智能推荐

2023编程语言趋势_各程序设计语言最新发展趋势-程序员宅基地

文章浏览阅读3.5w次,点赞73次,收藏121次。Python持续霸榜,PHP依旧颓势,Java雄风不再,Rust热度不减,汇编迅速崛起,C语言地位稳固_各程序设计语言最新发展趋势

前方高能!2023开放原子开发者大会亮点攻略,一触即发-程序员宅基地

文章浏览阅读5.1k次,点赞25次,收藏22次。12月16-17日中国 · 无锡。

layui框架学习(35:数据表格_列参数设置)_layui表格-程序员宅基地

文章浏览阅读2.6k次。学习并记录layui框架中内置模块的数据表格模块中与列相关的主要参数设置方式。_layui表格

使用IntelliJ IDEA进行远程调试Flink大数据代码_使用intellij idea进行远程调试flink大数据代码 百度快照-程序员宅基地

文章浏览阅读367次。本文将介绍如何使用IntelliJ IDEA进行远程调试Flink代码的步骤,并提供相应的源代码示例。通过使用IntelliJ IDEA进行远程调试,我们可以方便地对Flink大数据代码进行调试和排查问题。本文介绍了使用IntelliJ IDEA进行远程调试Flink代码的步骤,并提供了一个简单的WordCount示例。在IntelliJ IDEA中,点击右上角的"Debug"按钮,选择之前创建的远程调试配置。在IntelliJ IDEA中,点击"Debug"按钮启动Flink作业。步骤4:启动远程调试。_使用intellij idea进行远程调试flink大数据代码 百度快照

Apache部署超详细教程-程序员宅基地

文章浏览阅读4.4w次,点赞57次,收藏429次。Apache服务器部署背景Apache与Nginx对比Apache的部署安装Apache的基础信息修改Apache默认配置修改默认端口修改默认发布文件修改默认发布目录Apache的虚拟主机如何配置虚拟主机排错思路Apache内部的访问控制基于IP基于用户背景百度百科:Apache是世界使用排名第一的Web服务器软件。它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,..._apache部署

云苍穹-开发资料大全_金蝶云 官网开发资料-程序员宅基地

文章浏览阅读1.9w次。苍穹开发环境,搭建资料1、轻量级工具下载(金蝶云盘):https://pan.kingdee.com/s/MTE2MDk0Nyw5NGQ4#/2、轻量级工具安装与配置资料:https://dev.kingdee.com/index/docsNew/9fed8215-c3fb-496d-8954-bae78daf24bc学习与资源入口 https://dev.kingdee.com/index/home1、轻量级工具下载(金蝶云盘):https://pan.kingdee.com/s/MTE2._金蝶云 官网开发资料

随便推点

Delphi-XE5-手势操作-Gestures-使用方法_delphi安卓添加手势-程序员宅基地

文章浏览阅读4.8k次。Delphi-XE5-手势操作-Gestures-使用方法一、首先转载一下别人的方法介绍:今天尝试了TTabControl的使用。在很多Android的app中,首次启动时都使用选项卡模式进行产品介绍,用户通过向左滑动,改变选项卡。在xe5下这项工作由TTabControl控件完成,如下图: 1、TTabControl外观TTabContro_delphi安卓添加手势

cut命令-程序员宅基地

文章浏览阅读3.9k次,点赞7次,收藏27次。cut命令_cut命令

Web3.0时代什么时候到来,Web3.0有什么机会?_社交网络 web3.0-程序员宅基地

文章浏览阅读6.1k次,点赞65次,收藏89次。什么是web3.0?web3.0和web2.0以及web1.0有什么不一样?web3.0需要哪些技术支撑?web3.0有哪些应用场景?web3.0什么时候到来?普通人有哪些机会?开发者需要掌握哪些开发技术?随着科技的飞速发展,互联网也在不断演变。从Web1.0到Web2.0,我们已经见证了互联网从单向信息传递到用户参与互动的转变。而现在,我们正站在迈向Web3.0时代的门槛上。今天本文就来探讨相关话题。_社交网络 web3.0

帆软报表 出现多余空白页_帆软打印出现空白页-程序员宅基地

文章浏览阅读1.1w次。. 描述若您的模板内容明明是一页就可以显示出来,但是分页预览时却出来两页,而第二页却没有数据是空白页,原因是您的模板中有多余的空白格没有删除。这种情况可能由两种原因引起,一种是空白单元格导致使其有多余的空白页,另外一种情况是制作的模板中有多余的空白sheet。2.问题的原因2.1空白单元格导致使其有多余的空白页示例:如:如下您在 H2 单元格填上数据并设置格式后,删除该..._帆软打印出现空白页

iframe中设置无滚动条_iframe无滚动条-程序员宅基地

文章浏览阅读3.6w次。1、只有水平滚动条: //auto、yesindex.html中:body{overflow-y:hidden;} //隐藏了垂直的2、只有垂直滚动条: //auto、yesindex.html中:body{overflow-x:hidden;} //隐藏了水平的3、水平、垂直都没有: //auto、yesindex.html中:body{o_iframe无滚动条

B站---【狂神说Java】JavaWeb入门到实战---笔记-程序员宅基地

文章浏览阅读10w+次,点赞1.2k次,收藏7.6k次。JavaWebJava Web1、基本概念web开发:·web,网页的意思,www.baidu.com·静态web。html,sss。提供给所有人看的数据始终不会发生变化!动态web。淘宝,几乎是所有的网站;。提供给所有人看的数据始终会发生变化,每个人在不同的时间,不同的地点看到的信息各不相同!。技术栈:Servlet/ISP,ASP,PHP..._狂神说jav