2016年2月13日

【POJ】2104 K-th Number

摘要: 区间第K大数。主席树可解。 1 /* 2104 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #include <map> 6 #include <queue> 7 #include <set> 8 #incl 阅读全文

posted @ 2016-02-13 23:57 Bombe 阅读(163) 评论(0) 推荐(0) 编辑

【HDOJ】4355 Party All the Time

摘要: 好久没做过三分的题目了。 1 /* 4355 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #include <map> 6 #include <queue> 7 #include <set> 8 #inclu 阅读全文

posted @ 2016-02-13 22:33 Bombe 阅读(175) 评论(0) 推荐(0) 编辑

【HDOJ】4345 Permutation

摘要: 即求P1^n1+P2^n2 + ... + Pk^nk <= n,其中Pk为素数的所有可能组合。思路是DP。1~1000的素数就不到200个。dp[i][j]表示上式和不超过且当前最小素数为P[j]的所有可能情况。注意dp[i][0]+1即为所求。 1 /* 4345 */ 2 #include < 阅读全文

posted @ 2016-02-13 22:02 Bombe 阅读(174) 评论(0) 推荐(0) 编辑

【POJ】3468 A Simple Problem with Integers

摘要: 这题用线段树轻松解了,重新用树状数组解,关键点是区间更新。公式推导如下:sum[x] = org_sum[x] + delta[1]*x + delta[2]*(x-1) + delta[x]*1 = org_sum[x] + Sigma(delta[1..x]) * (x+1) - Sigma(d 阅读全文

posted @ 2016-02-13 17:54 Bombe 阅读(146) 评论(0) 推荐(0) 编辑

【HDOJ】4348 To the moon

摘要: 主席树区间更新,延迟标记。 1 /* 4348 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #include <map> 6 #include <queue> 7 #include <set> 8 #incl 阅读全文

posted @ 2016-02-13 17:37 Bombe 阅读(236) 评论(0) 推荐(0) 编辑

【ZOJ】2112 Dynamic Rankings

摘要: 树状数组套主席树模板题目。 1 /* 2112 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #include <map> 6 #include <queue> 7 #include <set> 8 #incl 阅读全文

posted @ 2016-02-13 13:03 Bombe 阅读(137) 评论(0) 推荐(0) 编辑

【POJ】1811 Prime Test

摘要: rabin_miller判断素数,pollard rho求质因式分解。别人的模板。 1 /* 4344 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #include <map> 6 #include <que 阅读全文

posted @ 2016-02-13 00:35 Bombe 阅读(199) 评论(0) 推荐(0) 编辑

【HDOJ】4343 Interval query

摘要: 最大不相交集合的数量。思路是dp[i][j]表示已经有i个不相交集合下一个不相交集合的最右边界。离散化后,通过贪心解。 1 /* 4343 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #include <ma 阅读全文

posted @ 2016-02-13 00:04 Bombe 阅读(231) 评论(0) 推荐(0) 编辑

导航