随笔分类 -  动态规划 背包问题

摘要:4976: 宝石镶嵌 Description 魔法师小Q拥有n个宝石,每个宝石的魔力依次为w_1,w_2,...,w_n。他想把这些宝石镶嵌到自己的法杖上,来提升 法杖的威力。不幸的是,小Q的法杖上宝石镶嵌栏太少了,他必须扔掉k个宝石才能将剩下的宝石镶嵌上去。法杖的 威力等于镶嵌在上面的所有宝石的魔 阅读全文
posted @ 2017-09-05 18:58 meekyan 阅读(297) 评论(0) 推荐(0)
摘要:4197: [Noi2015]寿司晚宴 Description 为了庆祝 NOI 的成功开幕,主办方为大家准备了一场寿司晚宴。小 G 和小 W 作为参加 NOI 的选手,也被邀请参加了寿司晚宴。 在晚宴上,主办方为大家提供了 n−1 种不同的寿司,编号 1,2,3,…,n−1,其中第 i 种寿司的美 阅读全文
posted @ 2017-08-20 12:37 meekyan 阅读(232) 评论(0) 推荐(0)
摘要:Free from square Problem Description There is a set including all positive integers that are not more then n. HazelFan wants to choose some integers f 阅读全文
posted @ 2017-08-17 19:08 meekyan 阅读(269) 评论(0) 推荐(0)
摘要:1042: [HAOI2008]硬币购物 Description 硬币购物一共有4种硬币。面值分别为c1,c2,c3,c4。某人去商店买东西,去了tot次。每次带di枚ci硬币,买si的价值的东西。请问每次有多少种付款方法。 硬币购物一共有4种硬币。面值分别为c1,c2,c3,c4。某人去商店买东西 阅读全文
posted @ 2017-08-04 13:15 meekyan 阅读(179) 评论(0) 推荐(0)
摘要:时间限制:20000ms 单点时限:1000ms 内存限制:256MB 描述 在写代码时,我们经常要用到类似 x × a 这样的语句( a 是常数)。众所周知,计算机进行乘法运算是非常慢的,所以我们需要用一些加法、减法和左移的组合来实现乘一个常数这个操作。具体来讲, 我们要把 x × a 替换成:( 阅读全文
posted @ 2017-06-27 12:13 meekyan 阅读(300) 评论(0) 推荐(0)
摘要:C. Divide by Three A positive integer number n is written on a blackboard. It consists of not more than 105 digits. You have to transform it into a be 阅读全文
posted @ 2017-03-29 11:13 meekyan 阅读(389) 评论(0) 推荐(0)
摘要:C. Dima and Salad Dima, Inna and Seryozha have gathered in a room. That's right, someone's got to go. To cheer Seryozha up and inspire him to have a w 阅读全文
posted @ 2017-03-13 17:37 meekyan 阅读(439) 评论(0) 推荐(0)
摘要:The more, The Better Problem Description ACboy很喜欢玩一种战略游戏,在一个地图上,有N座城堡,每座城堡都有一定的宝物,在每次游戏中ACboy允许攻克M个城堡并获得里面的宝物。但由于地理位置原因,有些城堡不能直接攻克,要攻克这些城堡必须先攻克其他某一个特定 阅读全文
posted @ 2016-07-20 16:46 meekyan 阅读(198) 评论(0) 推荐(0)
摘要:Rebuilding Roads Description The cows have reconstructed Farmer John's farm, with its N barns (1 <= N <= 150, number 1..N) after the terrible earthqua 阅读全文
posted @ 2016-07-20 15:52 meekyan 阅读(305) 评论(0) 推荐(0)
摘要:Description As Harry Potter series is over, Harry has no job. Since he wants to make quick money, (he wants everything quick!) so he decided to rob ba 阅读全文
posted @ 2016-07-16 10:50 meekyan 阅读(323) 评论(0) 推荐(0)
摘要:E. The Values You Can Make Pari wants to buy an expensive chocolate from Arya. She has n coins, the value of the i-th coin is ci. The price of the cho 阅读全文
posted @ 2016-06-30 20:41 meekyan 阅读(222) 评论(0) 推荐(0)
摘要:1025: [SCOI2009]游戏 Description windy学会了一种游戏。对于1到N这N个数字,都有唯一且不同的1到N的数字与之对应。最开始windy把数字按顺序1,2,3,……,N写一排在纸上。然后再在这一排下面写上它们对应的数字。然后又在新的一排下面写上它们对应的数字。如此反复,直 阅读全文
posted @ 2016-03-08 22:34 meekyan 阅读(217) 评论(0) 推荐(0)
摘要:Jam's balance Problem Description Jim has a balance and N weights. (1≤N≤20)The balance can only tell whether things on different side are the same wei 阅读全文
posted @ 2016-01-30 23:39 meekyan 阅读(284) 评论(0) 推荐(0)
摘要:1296: [SCOI2009]粉刷匠Descriptionwindy有 N 条木板需要被粉刷。 每条木板被分为 M 个格子。 每个格子要被刷成红色或蓝色。 windy每次粉刷,只能选择一条木板上一段连续的格子,然后涂上一种颜色。 每个格子最多只能被粉刷一次。 如果windy只能粉刷 T 次,他最多... 阅读全文
posted @ 2016-01-02 16:43 meekyan 阅读(217) 评论(0) 推荐(0)
摘要:D. Red-Green TowersThere arerred andggreen blocks for construction of thered-greentower.Red-greentower can be built following next rules:Red-green tow... 阅读全文
posted @ 2015-10-31 19:48 meekyan 阅读(430) 评论(0) 推荐(0)
摘要:D - Pick The SticksDescriptionThe story happened long long ago. One day, Cao Cao made a special order called "Chicken Rib" to his army. No one got his... 阅读全文
posted @ 2015-10-30 19:54 meekyan 阅读(400) 评论(0) 推荐(1)
摘要:B. Modulo Sum time limit per test ... 阅读全文
posted @ 2015-09-11 16:16 meekyan 阅读(299) 评论(0) 推荐(0)
摘要:B -Gold minerTime Limit:2000MSMemory Limit:32768KB DescriptionHomelesser likes playing Gold miners in class. He has to pay much attention to the teac... 阅读全文
posted @ 2015-08-20 19:47 meekyan 阅读(189) 评论(0) 推荐(0)