动规
文章平均质量分 78
Techay
我是为了c币才写的简介
展开
-
最大连续子序列
Description给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ..., Nj },其中 1 例如给定序列{ -2, 11, -4, 13, -5, -2 },其最大连续子序列为{ 11, -4, 13 },最大和 为20。 在今年的数据结构考卷中,要求编写程序得到最大和,现在增加原创 2015-06-17 21:45:45 · 292 阅读 · 0 评论 -
607A Chain Reaction(DP)
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction原创 2016-01-02 17:04:53 · 899 阅读 · 0 评论 -
Maximum Absurdity(dp)
Reforms continue entering Berland. For example, during yesterday sitting the Berland Parliament approved as much as n laws (each law has been assigned a unique number from 1 to n). Today all these laws原创 2015-12-17 21:46:43 · 441 阅读 · 0 评论 -
A and B and Interesting Substrings(dp)
A and B are preparing themselves for programming contests.After several years of doing sports programming and solving many problems that require calculating all sorts of abstract objects, A and B also原创 2015-12-17 21:52:39 · 394 阅读 · 0 评论 -
Sumsets(递推)
Description Farmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers that are an integer power of 2. Here are the possible sets of n原创 2016-01-14 20:39:10 · 345 阅读 · 0 评论 -
Apple Catching(DP)
Description It is a little known fact that cows love apples. Farmer John has two apple trees (which are conveniently numbered 1 and 2) in his field, each full of apples. Bessie cannot reach the apples原创 2016-01-14 20:49:34 · 575 阅读 · 0 评论 -
Milking Time(DP)
Description Bessie is such a hard-working cow. In fact, she is so focused on maximizing her productivity that she decides to schedule her next N (1 ≤ N ≤ 1,000,000) hours (conveniently labeled 0..N-1)原创 2016-01-14 20:58:37 · 457 阅读 · 0 评论 -
Cheapest Palindrome(DP)
Description Keeping track of all the cows can be a tricky task so Farmer John has installed a system to automate it. He has installed on each cow an electronic ID tag that the system will read as the原创 2016-01-14 21:04:18 · 361 阅读 · 0 评论 -
Coins(背包DP)
Description People in Silverland use coins.They have coins of value A1,A2,A3…An Silverland dollar.One day Tony opened his money-box and found there were some coins.He decided to buy a very nice watch原创 2016-01-14 21:16:32 · 339 阅读 · 0 评论 -
1030 Discovering Gold(水DP)
You are in a cave, a long cave! The cave can be represented by a 1 x N grid. Each cell of the cave can contain any amount of gold.Initially you are in position 1. Now each turn you throw a perfect 6 si原创 2016-03-05 23:16:35 · 414 阅读 · 0 评论 -
Food Delivery(区间DP)
When we are focusing on solving problems, we usually prefer to stay in front of computers rather than go out for lunch. At this time, we may call for food delivery.Suppose there are N people living in原创 2016-03-05 23:31:30 · 604 阅读 · 0 评论 -
1031 - Easy Game(博弈dp)
You are playing a two player game. Initially there are n integer numbers in an array and player A and B get chance to take them alternatively. Each player can take one or more numbers from the left or原创 2016-03-07 21:59:29 · 381 阅读 · 0 评论 -
1033 - Generating Palindromes(傻DP)
By definition palindrome is a string which is not changed when reversed. “MADAM” is a nice example of palindrome. It is an easy job to test whether a given string is a palindrome or not. But it may not原创 2016-03-07 22:00:44 · 377 阅读 · 0 评论 -
1037 - Agent 47(状压DP)
Agent 47 is in a dangerous Mission “Black Monster Defeat - 15”. It is a secret mission and so 47 has a limited supply of weapons. As a matter of fact he has only one weapon the old weak “KM .45 Tactica原创 2016-03-07 22:03:51 · 401 阅读 · 0 评论 -
1044 - Palindrome Partitioning(记忆化DP)
A palindrome partition is the partitioning of a string such that each separate substring is a palindrome.For example, the string “ABACABA” could be partitioned in several different ways, such as {“A”,”原创 2016-03-09 23:22:32 · 472 阅读 · 0 评论 -
不要62(数位DP)
Description 杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。 不吉利的数字为所有含有4或62的号码。例如: 62315 73418 88914 都属于不吉利号码。但是,61152虽然含有6和2,但不是原创 2016-03-09 23:33:47 · 422 阅读 · 0 评论 -
Bomb(数位DP)
Description The counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bomb. The number sequence of the time bomb counts from 1 to N. If the current number原创 2016-03-09 23:41:41 · 570 阅读 · 0 评论 -
Caesar's Legions(记忆化搜索)
Gaius Julius Caesar, a famous general, loved to line up his soldiers. Overall the army had n1 footmen and n2 horsemen. Caesar thought that an arrangement is not beautiful if somewhere in the line there原创 2015-12-17 21:56:59 · 623 阅读 · 0 评论 -
Writing Code(DP)
Programmers working on a large project have just received a task to write exactly m lines of code. There are n programmers working on a project, the i-th of them makes exactly ai bugs in every line of原创 2015-12-17 21:40:20 · 490 阅读 · 0 评论 -
Cow Exhibition(DP)
Description “Fat and docile, big and dumb, they look so stupid, they aren’t much fun…” - Cows with Guns by Dana Lyons The cows want to prove to the public that they are both smart and fun. In orde原创 2016-01-15 21:15:33 · 455 阅读 · 0 评论 -
George and Job
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced原创 2015-06-19 23:25:55 · 582 阅读 · 0 评论 -
免费馅饼
Description都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,原创 2015-06-19 23:35:33 · 222 阅读 · 0 评论 -
Milking Time
Milking TimeTime Limit:1000MS MemoryLimit:65536KB 64bitIO Format:%I64d &%I64uSubmit Status Practice POJ3616Appoint description: SystemCrawler (2015-04-30)DescriptionBess原创 2015-06-07 09:52:39 · 504 阅读 · 0 评论 -
哗啦啦村的扩建
Problem Description呀呀呀,哗啦啦村在日渐发展中,越来越大了。 唐老师看到这欣欣向荣的情景,感到非常开心。 狗哥在旁边,“喏,我们村子扩建这么快,肯定用了不少钱吧?” 唐老师说:“是呀,不过这些钱都不及我零花钱的万万分之一。”那么这时候问题来了,唐老师的零花钱至少应该有多少钱呢? 狗哥也想知道这道题的答案,于是他拜托了青君同学,了解到了村子扩建的费用。 啊,原来村子的扩建原创 2015-08-11 17:26:02 · 882 阅读 · 0 评论 -
哗啦啦村的日常游戏(一)抓个球
Problem Description唐老师和狗哥在玩哗啦啦村的日常游戏——抓个球。 在袋子里有w个白球,b个黑球。 唐老师和狗哥轮流从袋子里抓球,谁先抓到白球谁就胜利。 但是,令唐老师和狗哥没想到的是,小彭玉居然来捣乱了! 每当唐老师和狗哥一回合抓球结束后(各抓取一个球),小彭玉会偷偷的抓取一个球走。 那么这时候,问题来了,当唐老师先手的时候,唐老师获胜的概率是多少呢? 假设所有抓球都原创 2015-08-11 17:49:42 · 663 阅读 · 0 评论 -
喵哈哈的日常选数问题
Problem Description喵哈哈村子的TTT同学比较怪,他非常讨厌一类数字,是哪种呢? 就是讨厌那些含有37或者4的数 比如 21379,123485,12379。 但是他并不讨厌928357这个数,因为他即不包含37,也没有4。现在你[L,R]的区间,问你在这个区间中,最多能够选出多少个TTT同学不讨厌的数呢? Input输入两个整数,表示L和R 1 Outp原创 2015-08-11 17:45:42 · 323 阅读 · 0 评论 -
小彭玉的扫荡食堂计划
Problem Description哗啦啦村的食堂很奇怪,就是如果这个饭卡所剩金额低于5元的话,这个饭卡就不能刷了。 也就是说,只要这个饭卡金额大于等于5元,就可以随便刷~有一天,小彭玉看了看哗啦啦食堂的饭,“哇,好好吃!我要全部都买下来!” 但是小彭玉并没有那么多钱,于是他准备充分利用自己的钱,去买这些食物! 请问最后小彭玉的饭卡余额最少能到多少? Input多组测试数据(最多100组)原创 2015-08-11 17:10:14 · 505 阅读 · 0 评论 -
喵哈哈村的挑衅
Problem Description喵哈哈村就挨着哗啦啦村,他们很喜欢和哗啦啦村互黑~ 今天也不例外,喵哈哈派了智商流选手 青君 去挑衅哗啦啦村 哗啦啦村当然不会畏惧这种弱的挑衅,于是派出了谈笑风生的 狗哥 应战! 青君和狗哥站在一个空地上,空地上有两排物品,每排都有n个,每个物品都有一定价值 每次每个人只能拿第一排的最左边的物品,或者拿第一排最右边的物品,或者第二排最左边的物品,或者第二原创 2015-08-11 17:14:45 · 1257 阅读 · 0 评论 -
Longest Run on a Snowboard
Michael likes snowboarding. That’s not very surprising, since snowboarding is really great. The bad thing is that in order to gain speed, the area must slide downwards. Another disadvantage is that wh原创 2015-08-12 21:45:23 · 435 阅读 · 0 评论 -
Fixing the Great Wall
The Great Wall of China is truly one of the greatest wonders of the world. In 3-rd century BC, Emperor Qin Shi Huang connected the defensive structures built earlier by the states of Qin, Yan, and Zha原创 2015-08-13 12:02:22 · 1012 阅读 · 0 评论 -
A Spy in the Metro(dp)
Secret agent Maria was sent to Algorithms City to carry out an especially dangerous mission. After several thrilling events we find her in the first station of Algorithms City Metro, examining the tim原创 2015-10-22 00:23:04 · 453 阅读 · 0 评论 -
Party at Hali-Bula(树形dp)
Dear Contestant, I’m going to have a party at my villa at Hali-Bula to celebrate my retirement from BCM. I wish I could invite all my co-workers, but imagine how an employee can enjoy a party when he原创 2015-10-22 00:30:11 · 429 阅读 · 0 评论 -
Ant Counting(DP)
Description Bessie was poking around the ant hill one day watching the ants march to and fro while gathering food. She realized that many of the ants were siblings, indistinguishable from one another.原创 2016-01-15 20:48:22 · 433 阅读 · 0 评论 -
Dollar Dayz(DP)
Description Farmer John goes to Dollar Days at The Cow Store and discovers an unlimited number of tools on sale. During his first visit, the tools are selling variously for 1,1, 2, and 3.FarmerJohnhas原创 2016-01-15 20:51:14 · 407 阅读 · 0 评论 -
Bridging signals(DP)
Description ‘Oh no, they’ve done it again’, cries the chief designer at the Waferland chip factory. Once more the routing designers have screwed up completely, making the signals on the chip connectin原创 2016-01-15 20:54:06 · 405 阅读 · 0 评论 -
Space Elevator(DP)
Description The cows are going to space! They plan to achieve orbit by building a sort of space elevator: a giant tower of blocks. They have K (1 <= K <= 400) different types of blocks with which to b原创 2016-01-15 21:05:55 · 368 阅读 · 0 评论 -
搬寝室
Description搬寝室是很累的,xhd深有体会.时间追述2006年7月9号,那天xhd迫于无奈要从27号楼搬到3号楼,因为10号要封楼了.看着寝室里的n件物品,xhd开始发呆,因为n是一个小于2000的整数,实在是太多了,于是xhd决定随便搬2*k件过去就行了.但还是会很累,因为2*k也不小是一个不大于n的整数.幸运的是xhd根据多年的搬东西的经验发现每搬原创 2015-06-19 23:31:52 · 599 阅读 · 0 评论