码迷,mamicode.com
首页 >  
搜索关键字:kth    ( 692个结果
hdu 2665 可持久化线段树求区间第K大值(函数式线段树||主席树)
http://acm.hdu.edu.cn/showproblem.php?pid=2665 Problem Description Give you a sequence and ask you the kth big number of a inteval.   Input The first line is the number of the t...
分类:其他好文   时间:2015-04-24 12:33:31    阅读次数:116
hdu 4006 The kth great number
优先队列,真是水的不行~ 保持队列里只有K个元素即可 #include #include using namespace std; priority_queue, greater >mapp; int n,k; string cmd; int main() { while(cin>>n>>k) { while(mapp.size()) mapp.pop(); while(n--) ...
分类:其他好文   时间:2015-04-22 22:21:58    阅读次数:105
hdu 2665 Kth number (poj 2104 K-th Number) 划分树
划分树的基本功能是,对一个给定的数组,求区间[l,r]内的第k大(小)数。划分树的基本思想是分治,每次查询复杂度为O(log(n)),n是数组规模。具体原理见http://baike.baidu.com/link?url=vIUKtsKYx7byeS2KCOHUI14bt_0sdHAa9BA1Vce...
分类:其他好文   时间:2015-04-20 10:47:14    阅读次数:141
hdu 2665 Kth number
划分树 1 /* 2 HDU 2665 Kth number 3 划分树 4 5 6 */ 7 8 9 #include10 #include11 #include12 #include13 using namespace std;14 15 const int MAXN=100010;1...
分类:其他好文   时间:2015-04-18 15:54:54    阅读次数:130
HDU 4006 The kth great number(优先队列·第K大数)
题意  动态查询第K大的数 用小数在前优先队列维护K个数  每要插入一个数时 若这个数小于队首元素那么就不用插入了  否则队首元素出队  这个数入队  每次询问只用输出队首元素就行了 #include #include using namespace std; int main() { int n, a, k; char op[5]; while(~scanf("%d%...
分类:其他好文   时间:2015-04-14 14:45:18    阅读次数:175
Pascal's Triangle II--LeetCode
题目: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [1,3,3,1]. Note: Could you optimize your algorithm to use only O(k) extra space? ...
分类:其他好文   时间:2015-04-09 10:33:09    阅读次数:143
hdu 4006 The kth great number/SBT
size balance tree...
分类:其他好文   时间:2015-04-07 10:07:39    阅读次数:107
HDU 4006 The kth great number【优先队列】
题意:输入n行,k,如果一行以I开头,那么插入x,如果以Q开头,则输出第k大的数用优先队列来做,将队列的大小维护在k这么大,然后每次取队首元素就可以了另外这个维护队列只有k个元素的时候需要注意一下,先将输入的数都插入之后再将多余的数弹出去,这样才能保证留在队列里面的数是前k大的数另外想到set里面的...
分类:其他好文   时间:2015-04-02 20:44:58    阅读次数:146
Pascal's Triangle II(帕斯卡三角形)
Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use...
分类:其他好文   时间:2015-03-18 12:14:34    阅读次数:155
Lintcode: Kth Prime Number
Design an algorithm to find the kth number such that the only prime factors are 3, 5, and 7.The eligible numbers are like 3, 5, 7, 9, 15 ...ExampleIf ...
分类:其他好文   时间:2015-03-09 07:01:19    阅读次数:183
692条   上一页 1 ... 61 62 63 64 65 ... 70 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!