| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 436 人关注过本帖
标题:C语言的解法问题
取消只看楼主 加入收藏
一纸空白zj
Rank: 1
等 级:新手上路
帖 子:18
专家分:5
注 册:2010-12-14
结帖率:80%
收藏
 问题点数:0 回复次数:0 
C语言的解法问题
The kth great number
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others)

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

HintXiao  Ming  won't  ask  Xiao  Bao  the  kth  great  number  when  the  number  of  the  written number is smaller than k. (1=<k<=n<=1000000).
搜索更多相关主题的帖子: C语言 
2011-09-03 14:05
快速回复:C语言的解法问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022779 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved