"巴卡斯杯" 中国大学生程序设计竞赛 - 女生专场(重现) 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

智能推荐

Linux驱动开发——串口设备驱动_linux串口驱动开发-程序员宅基地

文章浏览阅读5k次,点赞6次,收藏43次。串口驱动开发_linux串口驱动开发

安装确认书模板_房屋租赁合同模板及审查要点-程序员宅基地

文章浏览阅读292次。公司成立后,选择办公场所成为一项重要工作。一般情况下,公司的办公场所都不是股东的自有房屋,而是需要通过租赁来选择合适的场地用来办公。因此,房屋租赁合同将不可避免的出现在公司经营过程之中,关于审核租赁合同需要关注哪些风险点呢?笔者将在本文中对于一些重点条款进行梳理。(注:本文租赁合同模版来源于深圳市住房和建设局2019年11月制《深圳市房屋租赁合同书(非住宅)》)模板1.1甲方出租给乙方的..._安装完成确认书

JUC学习(五):ArrayList的线程安全问题分析与解决方案(vector、Collections、写时复制技术)_arraylist和vector的线程安全-程序员宅基地

文章浏览阅读5.2k次。目录一、异常演示二、解决方案 1、vector 2、Collections工具类 3、CopyOnWriteArrayList 写时复制技术三、写时复制技术 1、特性 2、原理一、异常演示循环创建线程,将数据放入集合的同时,从集合中读取数据。/** * list集合线程不安全问题 */public class ThreadDemo04 {......_arraylist和vector的线程安全

Typo: In word 'xxx' less... (Ctrl+F1) 去掉错误拼写检查提示_typo: in word 'bookindex' less... (ctrl+f1) inspec-程序员宅基地

文章浏览阅读7.4k次。解决步骤:File -> SettingsEditor -> Code Style -> inspections -> Spelling -Typo 把勾选状态去掉,点击 OK即可_typo: in word 'bookindex' less... (ctrl+f1) inspection info: spellchecker in

谷歌浏览器设置打开链接在新标签页打开(打开网页时不覆盖原网页)_谷歌浏览器打开新网页在新窗口打开-程序员宅基地

文章浏览阅读1.1k次。1、登录自己的谷歌账户,随便搜索一个内容(如果没有账户,估计也在右上角有齿轮的地方,请找一下),选中更多设置。2、其他设置,选择“在新窗口中打开搜索结果”_谷歌浏览器打开新网页在新窗口打开

操作系统中典型的调度算法_非剥夺式优先级调度算法-程序员宅基地

文章浏览阅读2.6k次。操作系统 调度算法_非剥夺式优先级调度算法

随便推点

趋势预测算法大PK!_趋势预测算法 csdn-程序员宅基地

文章浏览阅读1w次,点赞5次,收藏61次。https://blog.csdn.net/dQCFKyQDXYm3F8rB0/article/details/106368395趋势预测在很多应用场景中都会起到至关重要的作用,比如淘宝商家会考虑库存量应该保持在多少才能够满足客户需求,商场希望得知假期会迎来多大的客流量以安排系列活动,机场想要预测五一黄金周会有多大的客运量来做相应的应急部署等。在智能运维领域,趋势预测同样具有一定的理论意义和实际应用价值。趋势预测在运维场景中的应用背景在实时监控系统中会采集到大量的数据,有些数据具有周期性等时_趋势预测算法 csdn

【无人车路径跟踪】基于神经网络的数据驱动迭代学习控制(ILC)算法,用于具有未知模型和重复任务的非线性单输入单输出(SISO)离散时间系统的无人车的路径跟踪(Matlab代码实现)-程序员宅基地

文章浏览阅读713次,点赞23次,收藏21次。摘要本文提出了一种基于神经网络的(NN-based)数据驱动迭代学习控制(ILC)算法,用于具有未知模型和重复任务的非线性单输入单输出(SISO)离散时间系统的跟踪问题。控制目标是使系统的输出在每次迭代过程中跟踪参考轨迹。因此,在每次迭代过程的每个相对时间点上,使用广义回归神经网络(GRNN)作为估计器来解决系统的关键参数,并使用径向基函数神经网络(RBFNN)作为控制器来解决控制输入。

Flask核心机制_runtimeerror: working outside of application conte-程序员宅基地

文章浏览阅读6.3k次,点赞2次,收藏4次。python编程快速上手(持续更新中…)python实战网上书店项目(Flask技术点More))1.首先写一段测试代码我们通过db.create_all(app=app)的方式解决了working outside application context的错误,下面我们来深究,这个错误出现的具体原因是什么。from flask import Flask, current_appapp = Flask(name)断点调试这里显示current_app=[LocalProxy]a = cur_runtimeerror: working outside of application context.

java中间件 - redis其他问题_master最好不要做任何持久化工作-程序员宅基地

文章浏览阅读1.1k次。Redis常见性能问题和解决方案?Master最好不要做任何持久化工作,包括内存快照和AOF日志文件,特别是不要启用内存快照做持久化。如果数据比较关键,某个Slave开启AOF备份数据,策略为每秒同步一次。为了主从复制的速度和连接的稳定性,Slave和Master最好在同一个局域网内。尽量避免在压力较大的主库上增加从库Master调用BGREWRITEAOF重写AOF文件,AOF在重写的时候会占大量的CPU和内存资源,导致服务load过高,出现短暂服务暂停现象。为了Master的稳定性,主_master最好不要做任何持久化工作

美赛备赛资料大全_美赛资料-程序员宅基地

文章浏览阅读4.2w次,点赞246次,收藏2.1k次。目录1、美赛比赛网址及其介绍2、美赛摘要页说明3、美赛常用词语与语句4、美赛翻译注意事项5、美赛论文写作一些建议5.1 团队方面准备5.2 摘要表部分5.3 评委关注点6、组队要求7、软件与一些建模网址参考(1)写一篇建模文章大致需要如下技能:(2)数学建模算法总结(3) word小白教程数据资料:(4)1982—2018中国统计年鉴大全链接(5)美国人口普查数据大全链接(6)美国城市数据大全链接(7)全球统计数..._美赛资料

Flutter 网络请求的三种简单实现-程序员宅基地

文章浏览阅读285次。概述:本文主要讲解了flutter网络请求三种方式 flutter自带的HttpClient、 第三方库http 和 第三方库Dio 的简单实现 GET 和 POST请求,本文是笔者学习Flutter网络模块知识总结,若有问题还望不腻赐教。一.系统自带HttpClient1.使用中温馨提示1.1.导入库import 'dart:io'; // 网络请求import 'dart:co..._flutter http.client和httpclient

推荐文章

热门文章

相关标签