上一页 1 2 3 4 5 6 7 8 9 10 ··· 57 下一页

2016年2月13日

【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 阅读(229) 评论(0) 推荐(0) 编辑

2016年2月12日

【HDOJ】4347 The Closest M Points

摘要: 居然是KD解。 1 /* 4347 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #include <map> 6 #include <queue> 7 #include <set> 8 #include <s 阅读全文

posted @ 2016-02-12 15:49 Bombe 阅读(186) 评论(0) 推荐(0) 编辑

【HDOJ】4341 Gold miner

摘要: 分组01背包。在一条直线上的点归为一组。 1 /* 4341 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #include <map> 6 #include <queue> 7 #include <set> 阅读全文

posted @ 2016-02-12 12:38 Bombe 阅读(142) 评论(0) 推荐(0) 编辑

2016年2月11日

【HDOJ】4333 Revolving Digits

摘要: 扩展KMP基础题目。 1 /* 4333 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #include <map> 6 #include <queue> 7 #include <set> 8 #include 阅读全文

posted @ 2016-02-11 23:19 Bombe 阅读(187) 评论(0) 推荐(0) 编辑

【HDOJ】4336 Card Collector

摘要: 概率DP的题目,一直就不会做这类题目。dp[s]表示状态为s的时候再买多少张牌可以买全,表示的是一个期望值。dp[s] = 1 + P(empty) * dp[s] + P(had) * dp[s] + P(new) * dp[nst]。从而可以解dp[s]。 1 /* 4336 */ 2 #inc 阅读全文

posted @ 2016-02-11 21:26 Bombe 阅读(174) 评论(0) 推荐(0) 编辑

2016年2月10日

【HDOJ】4328 Cut the cake

摘要: 将原问题转化为求完全由1组成的最大子矩阵。挺经典的通过dp将n^3转化为n^2。 1 /* 4328 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #include <map> 6 #include <queu 阅读全文

posted @ 2016-02-10 22:18 Bombe 阅读(191) 评论(0) 推荐(0) 编辑

【HDOJ】4322 Candy

摘要: 状态DP显然可以解,发现T了,不知道优化后能不能过。然后发现费用流可以解。trick是对need拆解成need/K, need%K两种情况讨论。 1 /* 4312 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 阅读全文

posted @ 2016-02-10 16:17 Bombe 阅读(217) 评论(0) 推荐(0) 编辑

2016年2月9日

【HDOJ】4317 Unfair Nim

摘要: 基本的状态压缩,想明白怎么dp还是挺简单的。显然对n个数字进行状态压缩,dp[i][j]表示第i位状态j表示的位向高位产生了进位。 1 /* 4317 */ 2 #include <iostream> 3 #include <sstream> 4 #include <string> 5 #inclu 阅读全文

posted @ 2016-02-09 23:09 Bombe 阅读(219) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 10 ··· 57 下一页

导航