摘要: The title of this problem is familiar,isn't it?yeah,if you had took part in the "Rookie Cup" competition,you must have seem this title.If you haven't 阅读全文
posted @ 2018-05-16 20:44 Roni_i 阅读(241) 评论(0) 推荐(0)
摘要: 在刷题的过程中,很多时候都用到区间[ maxn, maxn]。但我们知道常规的数组的下标都是从0开始的并没有负数,这时候,要么开一个二维数组,要么就是开一个[0, 2 maxn]的数组。 include using namespace std; const int maxn = 1e6; ///先声 阅读全文
posted @ 2018-05-16 19:16 Roni_i 阅读(1183) 评论(0) 推荐(0)
摘要: 背包恰好装满和不必装满的初始化区别 1.4 初始化的细节问题 我们看到的求最优解的背包问题题目中,事实上有两种不太相同的问法。有的题目要求“恰好装满背包”时的最优解,有的题目则并没有要求必须把背包装满。一种区别这两种问法的实现方法是在初始化的时候有所不同。 如果是第一种问法,要求恰好装满背包,那么在 阅读全文
posted @ 2018-05-16 18:41 Roni_i 阅读(501) 评论(0) 推荐(1)
摘要: "POJ 2184" 【题意】: 有n头牛,每头牛有自己的聪明值和幽默值,选出几头牛使得选出牛的聪明值总和大于0、幽默值总和大于0,求聪明值和幽默值总和相加最大为多少。 【分析】:变种的01背包,可以把幽默度看成体积,智商看成价值,那么就转换成求体积和价值都为正值的最大值的01背包了。 以 TS 作 阅读全文
posted @ 2018-05-16 18:10 Roni_i 阅读(420) 评论(0) 推荐(0)
摘要: It’s commonly known that the Dutch have invented copper wire. Two Dutch men were fighting over a nickel, which was made of copper. They were both so e 阅读全文
posted @ 2018-05-16 16:37 Roni_i 阅读(425) 评论(0) 推荐(1)
摘要: 【代码】: 【一维 + vis标记数组 + 倒序输出】:用一个vis[i][j]记录容量为j的背包里面有没有用到过i物品,物品是倒着放的。 #include<cstdio> #include<string> #include<cstdlib> #include<cmath> #include<ios 阅读全文
posted @ 2018-05-16 15:03 Roni_i 阅读(171) 评论(0) 推荐(0)
摘要: 饭卡 Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 39562 Accepted Submission(s): 13548 Problem De 阅读全文
posted @ 2018-05-16 14:58 Roni_i 阅读(225) 评论(0) 推荐(0)