摘要: 有一种奇怪的大家族,这种家族里的人要么没有孩子,要么就有两个孩子。已知某个这种家族共有N个人,家族中共有K代人。你能告诉我这样的一个家族可能的家谱结构的种数除以9901的余数是多少吗?输入包括一行,包括两个被空格分开的整数,第一个为家族中的人数N(3≤N≤200),第二个为家族中的代数K(1 ... 阅读全文
posted @ 2017-10-23 15:51 besti_kuroko 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 晓萌希望将1到N的连续整数组成的集合划分成两个子集合,且保证每个集合的数字和是相等。例如,对于N=3,对应的集合{1,2,3}能被划分成{3}和 {1,2}两个子集合.这两个子集合中元素分别的和是相等的。对于N=3,我们只有一种划分方法,而对于N=7时,我们将有4种划分的方案。输入包括一行,仅... 阅读全文
posted @ 2017-10-22 16:06 besti_kuroko 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 给定一个非负整数数组,假定你的初始位置为数组第一个下标。数组中的每个元素代表你在那个位置能够跳跃的最大长度。请确认你是否能够跳跃到数组的最后一个下标。例如:A = [2,3,1,1,4]A=[2,3,1,1,4] 能够跳跃到最后一个下标,输出true;A = [3,2,1,0,4]不能跳跃到最... 阅读全文
posted @ 2017-10-21 14:02 besti_kuroko 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 给定一个非负整数数组,假定你的初始位置为数组第一个下标。数组中的每个元素代表你在那个位置能够跳跃的最大长度。你的目标是到达最后一个下标,并且使用最少的跳跃次数。例如:A =[2,3,1,1,4],到达最后一个下标的最少跳跃次数为 2。(先跳跃 1步,从下标 0 到 1,然后跳跃 3步,到达最后... 阅读全文
posted @ 2017-10-20 20:12 besti_kuroko 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 假设你现在正在爬楼梯,楼梯有 nn 级。每次你只能爬 1 级或者 2 级,那么你有多少种方法爬到楼梯的顶部?输入格式第一行输入一个整数 n(1≤n≤50),代表楼梯的级数。输出格式输出爬到楼梯顶部的方法总数。样例输入5样例输出8简单的动态规划最后一次可以为一步也可以为两步,即n阶楼梯的问题转换... 阅读全文
posted @ 2017-10-19 19:15 besti_kuroko 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Arthur and his sister Caroll have beenplaying a game called Nim for some time now. Nim is played asfollows: The starting position has anumber of h... 阅读全文
posted @ 2017-10-18 09:28 besti_kuroko 阅读(137) 评论(0) 推荐(0) 编辑
摘要: Digital deletions is a two-player game.The rule of the game is as following.Begin by writing down a string of digits (numbers) that's as longor as ... 阅读全文
posted @ 2017-10-17 14:44 besti_kuroko 阅读(105) 评论(0) 推荐(0) 编辑
摘要: The doggie found a bone in an ancientmaze, which fascinated him a lot. However, when he picked it up,the maze began to shake, and the doggie could ... 阅读全文
posted @ 2017-10-15 13:10 besti_kuroko 阅读(144) 评论(0) 推荐(0) 编辑
摘要: I Think I Need a HouseboatTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 105572Accepted: 45982DescriptionFred Mapper isconsidering purcha... 阅读全文
posted @ 2017-10-07 10:37 besti_kuroko 阅读(236) 评论(0) 推荐(0) 编辑