随笔分类 -  动态规划

摘要:把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。 阅读全文
posted @ 2016-10-28 15:38 刺猬的玻璃心碎了 阅读(584) 评论(0) 推荐(0)
摘要:Hello Kitty 想摘点花生送给她喜欢的米老鼠。她来到一片有网格状道路的矩形花生地(如下图),从西北角进去,东南角出来。地里每个道路的交叉点上都有种着一株花生苗,上面有若干颗花生,经过一株花生苗就能摘走该它上面所有的花生。Hello Kitty只能向东或向南走,不能向西或向北走。问Hello Kitty 最多能够摘到多少颗花生。 阅读全文
posted @ 2016-10-27 12:36 刺猬的玻璃心碎了 阅读(394) 评论(0) 推荐(0)
摘要:有n个正整数,找出其中和为t(t也是正整数)的可能的组合方式。如: n=5,5个数分别为1,2,3,4,5,t=5; 那么可能的组合有5=1+4和5=2+3和5=5三种组合方式。 阅读全文
posted @ 2016-10-27 11:01 刺猬的玻璃心碎了 阅读(1091) 评论(0) 推荐(0)
摘要: 在N×N的棋盘里面放K个国王,使他们互不攻击,共有多少种摆放方案。国王能攻击到它上下左右,以及左上 左下右上右下八个方向上附近的各一个格子,共8个格子。 阅读全文
posted @ 2016-10-13 00:57 刺猬的玻璃心碎了 阅读(426) 评论(1) 推荐(0)
摘要:科学家们最近发现了一种奇怪的生物,它们每天长大一岁,刚出生的宝宝为1岁,且它们的年龄没有上限。已知年龄为1岁,2岁,3岁,……,k岁的个体具有生育能力,当年龄为i的具有生育能力的个体将长大一岁时会生下ai个1岁的幼崽。 阅读全文
posted @ 2016-10-09 00:36 刺猬的玻璃心碎了 阅读(162) 评论(0) 推荐(0)
摘要:Daxinganling produces a lot of timber. Before loading onto trains, the timberjacks will place the logs to some place in the open air first. Looking from the sideway, the figure of a logs stack is as follows: We have known that the number of logs in each layer is fewer than the lower layer for at least one log, and that in each layer the logs are connected in a line. In the figure above, the 阅读全文
posted @ 2016-09-30 01:06 刺猬的玻璃心碎了 阅读(615) 评论(1) 推荐(1)