http://acm.hdu.edu.cn/showproblem.php?pid=4006
Problem Description
Xiao Ming and Xiao Bao are playing a simple Numbers game. In a round Xiao Ming can choose to write down a number, or ask Xiao Bao what the kth great number is. Because the number written by Xiao Ming is too much, Xiao Bao is feeling giddy. Now, try to help
Xiao Bao.
Input
There are several test cases. For each test case, the first line of input contains two positive integer n, k. Then n lines follow. If Xiao Ming choose to write down a number, there will be an " I" followed by a number that Xiao Ming will write down. If Xiao
Ming choose to ask Xiao Bao, there will be a "Q", then you need to output the kth great number.
Output
The output consists of one integer representing the largest number of islands that all lie on one line.
Sample Input
8 3
I 1
I 2
I 3
Q
I 5
Q
I 4
Q
Sample Output
1
2
3
这道题有点下技巧,就是用了STL中multiset容器,可以自动从小到大排序,而且可以允许每次都插入相同的元素,还有就是每次要保证容器中有k个元素,
代码1:
代码二:
分享到:
相关推荐
The 36th ACM/ICPC Asia Regional Shanghai Site —— Online Contest Problem Set
The 36th ACM/ICPC Asia Regional Dalian Site —— Online Contest 注意,解压密码是:3.1415926535897932384
THE 30th ACM/ICPC ASIA REGIONAL 2005 HANGZHOU SITE Onsite Contest Session 8:30am – 13:30pm, November 20th 2005 (GMT+8) <br>知道是什么了吧。。。
ACM/ICPC参赛者必备!模版库,数十页的C++代码,涵盖ACM/ICPC中出现的各种算法!此为吉林大学版,内容相对比较全,排版质量是各校的模板中最好的!
IOI/ACM/ICPC参赛人员的理想选择——《算法艺术与信息学竞赛》
acm/icpc 课件 贪心 递归 图论 最大矩阵乘积 acm/icpc 课件 贪心 递归 图论 最大矩阵乘积 acm/icpc 课件 贪心 递归 图论 最大矩阵乘积 acm/icpc 课件 贪心 递归 图论 最大矩阵乘积 acm/icpc 课件 贪心 递归 图论 ...
ACM/ICPC大赛
ACM/ICPC中国*辽宁第二届大学生程序设计竞赛题目
搜索
acm/icpc算法集合。acm/icpc算法集合。acm/icpc算法集合。
2015-2016 ACM-ICPC Northeastern European Regional Contest 标程
ACM/ICPC World Finals 1990 task
ACM/ICPC2009 拉丁美洲区域赛 包含输入输出数据 题目PDF文档 详细解题报告+答案代码TXT文档 有一半是水题,2、3个比较难的 大家可以拿来做做 其中的输入输出数据,可以放到那个离线OJ系统去判断你的程序对错。(离线...
ACM/ICPC的教学与实践
动态规划——北京大学暑期课《ACM/ICPC竞赛训练》
浙江师范大学 ACM/ICPC 集训队――算法设计入门学习资料浙江师范大学 ACM/ICPC 集训队――算法设计入门学习资料
2010年ACM/ICPC珠海区域赛决赛题目
ACM/icpc的练习题目分类,非常全面的关于poj题目的分类
ACM/ICPC模板 内容大概有这些 其他 --高精度模板 --RMQ --改点堆优化的dijkstra算法 --快速付利叶变换 --稳定婚姻问题 --SPFA(最短路快速算法) // thanks to love8909 几何相关 --初等几何学 --多边形几何 --...
本代码包括了常见的ACM算法,并给出了详细地实现过程,并附上了ACM/ICPC 竞赛之STL。