
动态规划
文章平均质量分 69
qq_775395462
是什么让我们每天早上7点起床,不辞辛苦来到公司上班,是穷吗?
不,是对老板的信任以及对公司企业文化的认可!
展开
-
Dividing
DescriptionMarsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equal share of the marbles. This would be easy if all the marbl原创 2014-08-22 21:14:24 · 302 阅读 · 0 评论 -
How many ways(记忆化搜索)
Description这是一个简单的生存游戏,你控制一个机器人从一个棋盘的起始点(1,1)走到棋盘的终点(n,m)。游戏的规则描述如下:1.机器人一开始在棋盘的起始点并有起始点所标有的能量。 2.机器人只能向右或者向下走,并且每走一步消耗一单位能量。 3.机器人不能在原地停留。 4.当机器人选择了一条可行路径后,当他走到这条路径的终点时,他将只有终点所标记的能量。原创 2015-02-02 16:23:01 · 427 阅读 · 0 评论 -
搬寝室
Description搬寝室是很累的,xhd深有体会.时间追述2006年7月9号,那天xhd迫于无奈要从27号楼搬到3号楼,因为10号要封楼了.看着寝室里的n件物品,xhd开始发呆,因为n是一个小于2000的整数,实在是太多了,于是xhd决定随便搬2*k件过去就行了.但还是会很累,因为2*k也不小是一个不大于n的整数.幸运的是xhd根据多年的搬东西的经验发现每搬一次的疲劳度是和左右手的物品原创 2015-02-02 15:15:45 · 285 阅读 · 0 评论 -
最大连续子序列
Description给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ...,Nj },其中 1 例如给定序列{ -2, 11, -4, 13, -5, -2 },其最大连续子序列为{ 11, -4, 13 },最大和 为20。 在今年的数据结构考卷中,要求编写程序得到最大和,现在增加一个要求,即还需要输出该原创 2015-02-01 18:23:11 · 288 阅读 · 0 评论 -
windy数(数位DP)
Descriptionwindy定义了一种windy数。不含前导零且相邻两个数字之差至少为2的正整数被称为windy数。 windy想知道,在A和B之间,包括A和B,总共有多少个windy数?Input包含两个整数,A B。Output一个整数。Sample Input【输入样例原创 2015-01-30 13:32:57 · 413 阅读 · 0 评论 -
Humble Numbers
DescriptionA number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the first原创 2014-12-07 11:38:49 · 232 阅读 · 0 评论 -
不要62(数位DP)
Description杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。不吉利的数字为所有含有4或62的号码。例如: 62315 73418 88914 都属于不吉利号码。但是,61152虽然含有6和2原创 2015-01-30 14:37:31 · 345 阅读 · 0 评论 -
Bribing FIPA(树形DP)
DescriptionThere is going to be a voting at FIPA (Fédération Internationale de Programmation Association) to determine the host of the next IPWC (International Programming World Cup). Benj原创 2015-01-29 18:41:24 · 441 阅读 · 0 评论 -
Round and Round We Go
DescriptionA cyclic number is an integer n digits in length which, when multiplied by any integer from 1 to n, yields a"cycle"of the digits of the original number. That is, if you consider the原创 2015-01-29 18:37:20 · 303 阅读 · 0 评论 -
整数划分
题目描述:整数划分是一个经典的问题,希望这道题对你的组合数学有所帮助. 提示 1. 将5划分成若干正整数之和的划分为: 5, 4+1, 3+2, 3+1+1, 2+2+1, 2+1+1+1, 1+1+1+1+1 2. 将5划分成2个正整数之和的划分为: 3+2, 4+1 3. 将5划分成最大数不超过2的划分为: 1+1+1+1+1, 1+1+1+2, 1+2+2 4.原创 2015-01-26 15:48:40 · 367 阅读 · 0 评论 -
最长公共子串
#include#include#include#includeusing namespace std;const int MAX = 300;char a[MAX],b[MAX];void c(char *str1, char *str2){ int i,j,k,len1,len2,mm,x,y; len1 = strlen(str1); len2 = s原创 2014-12-17 17:54:29 · 312 阅读 · 0 评论 -
Common Subsequence(最长公共子序列)
DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequence of X if there exi原创 2015-01-25 12:01:06 · 309 阅读 · 0 评论 -
To the Max
DescriptionGiven a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located within the whole array. The sum of a re原创 2015-01-24 12:42:30 · 274 阅读 · 0 评论