随笔分类 - 动态规划
摘要:题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=648&page=show_problem&problem=5155There are N guests checki...
阅读全文
摘要:题目链接:http://hihocoder.com/contest/msbop2015qual/problemsA.2月29日首先为了方便处理可以分类一下把问题转化成第a年到第b年的闰年数量。然后如果要求fun(x)=1~x年中闰年的数量,容斥一下就是 (1~x中4的倍数) -(1~x中100的倍数...
阅读全文
摘要:题目链接:http://www.spoj.com/problems/COT3/Alice and Bob are playing a game on a tree of n nodes.Each node is either black or white initially.They take tu...
阅读全文
摘要:Problem DescriptionAfter eating food from Chernobyl, DRD got a super power: he could clone himself right now! He used this power for several times. He...
阅读全文
摘要:Dr. X is a biologist, who likes rabbits very much and can do everything for them. 2012 is coming, and Dr. X wants to take some rabbits to Noah's Ark, ...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4064Problem DescriptionCarcassonneis a tile-based board game for two to five players.Square tiles are p...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2993Problem DescriptionConsider a simple sequence which only contains positive integers as a1, a2 ... a...
阅读全文
摘要:DescriptionP教授要去看奥运,但是他舍不下他的玩具,于是他决定把所有的玩具运到北京。他使用自己的压缩器进行压缩,其可以将任意物品变成一堆,再放到一种特殊的一维容器中。P教授有编号为1...N的N件玩具,第i件玩具经过压缩后变成一维长度为Ci.为了方便整理,P教授要求在一个一维容器中的玩具编...
阅读全文
摘要:Problem DescriptionThere is an old country and the king fell in love with a devil. The devil always asks the king to do some crazy things. Although th...
阅读全文
摘要:Problem Description一个{1, ..., n}的子集S被称为JZP集,当且仅当对于任意S中的两个数x,y,若(x+y)/2为整数,那么(x+y)/2也属于S。例如,n=3,S={1,3}不是JZP集,因为(1+3)/2=2不属于S。但是{1,2,3}的其他子集都属于S,所以n=3时...
阅读全文
摘要:Problem Description小A想通过合理投资银行理财产品达到收益最大化。已知小A在未来一段时间中的收入情况,描述为两个长度为n的整数数组dates和earnings,表示在第dates[i]天小A收入earnings[i]元(0 2 #include 3 #include 4 #in...
阅读全文
摘要:Problem Description 小度和小良最近又迷上了下棋。棋盘一共有N行M列,我们可以把左上角的格子定为(1,1),右下角的格子定为(N,M)。在他们的规则中,“王”在棋盘上的走法遵循十字路线。也就是说,如果“王”当前在(x,y)点,小度在下一步可以移动到(x+1, y), (x-1, ...
阅读全文
摘要:Problem Description 吉哥这几天对队形比较感兴趣。 有一天,有n个人按顺序站在他的面前,他们的身高分别是h[1], h[2] ... h[n],吉哥希望从中挑出一些人,让这些人形成一个新的队形,新的队形若满足以下三点要求,则称之为完美队形: 1、挑出的人保持他们在原队形的...
阅读全文
摘要:This is a two player game. Initially there areninteger numbers in an array and playersAandBget chance to take them alternatively. Each player can take...
阅读全文
摘要:DescriptionLetxandybe two strings over some finite alphabetA. We would like to transformxintoyallowing only operations given below:Deletion:a letter i...
阅读全文
摘要:Problem DescriptionRompire is a robot kingdom and a lot of robots live there peacefully. But one day, the king of Rompire was captured by human beings. His thinking circuit was changed by human and thus became a tyrant. All those who are against him were put into jail, including our clever Micheal#1
阅读全文
摘要:Given a 2-dimensional array of positive and negative integers, find the sub-rectangle with the largest sum. The sum of a rectangle is the sum of all the elements in that rectangle. In this problem the sub-rectangle with the largest sum is referred to as themaximal sub-rectangle. A sub-rectangle is a
阅读全文
摘要:In the present world you frequently meet a lot of call numbers and they are going to be longer and longer. You need to remember such a kind of numbers. One method to do it in an easy way is to assign letters to digits as shown in the following picture:1 ij 2 abc 3 def4 gh 5 kl 6 mn7 prs ...
阅读全文
摘要:Let's imagine how apple tree looks in binary computer world. You're right, it looks just like a binary tree, i.e. any biparous branch splits up to exactly two new branches. We will enumerate by integers the root of binary apple tree, points of branching and the ends of twigs. This way we may
阅读全文
摘要:DescriptionThis is back in the Wild West where everybody is fighting everybody. In particular, there are n cowboys, each with a revolver. These are rather civilized cowboys, so they have decided to take turns firing their guns until only one is left standing. Each of them has a given probability of
阅读全文

浙公网安备 33010602011771号