dfs
xiaofang3a
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
自然数拆分
Problem Description任何一个大于1的自然数n,总可以拆分成若干个小于n的自然数之和。Input输入有多组数据,对于每组数据就一个数n。Output对于每组输入输出n的拆分方法。Sample Input4Sample Output1+1+1+11+1+21+32+2原创 2014-07-18 13:20:26 · 585 阅读 · 0 评论 -
Function Run Fu
DescriptionWe all love recursion! Don't we? Consider a three-parameter recursive function w(a, b, c): if a 1 if a > 20 or b > 20 or c > 20, then w(a, b, c) returns: w(20, 20, 20) if a原创 2014-09-15 19:05:46 · 490 阅读 · 0 评论 -
邮递食物
Problem DescriptionCollege students have wide freedom in many circumstances. For instance, nowadays, more and more students choose to order food from outside school, instead of eating in the school原创 2014-09-24 14:56:54 · 583 阅读 · 0 评论 -
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 marbles转载 2014-09-14 22:49:34 · 391 阅读 · 0 评论 -
滑雪——dp
Problem Description小明喜欢滑雪,因为滑雪的确很刺激,可是为了获得速度,滑的区域必须向下倾斜,当小明滑到坡底,不得不再次走上坡或等直升机来载他,小明想知道在一个区域中最长的滑坡。滑坡的长度由滑过点的个数来计算,区域由一个二位数组给出,数组的每个数字代表点的高度。下面是一个例子:1 2 3 4 516 17 18 19 615 24 25 20 714 23 2原创 2014-08-14 09:42:00 · 1220 阅读 · 0 评论 -
FatMouse and Cheese
Problem DescriptionFatMouse has stored some cheese in a city. The city can be considered as a square grid of dimension n: each grid location is labelled (p,q) where 0 <= p < n and 0 <= q < n. At eac原创 2014-08-14 20:24:50 · 377 阅读 · 0 评论 -
黑白棋子的移动——深搜
Problem Description有2n个棋子(20≥n≥4)排成一行,开始位置为白子全部在左边,黑子全部在右边,如下图为n=5的情形:○○○○○●●●●●移动棋子的规则是:每次必须同时移动相邻的两个棋子,颜色不限,可以左移也可以右移到空位上去,但不能调换两个棋子的左右位置。每次移动必须跳过若干个棋子(不能平移),要求最后能移成黑白相间的一行棋子。如n=5时,成为:○●○●○●○●○●原创 2014-08-15 12:05:19 · 1351 阅读 · 0 评论 -
工作分配
Problem Description设有n件工作分配给n个人,将工作i分配给第j个人所需的费用为cij。试设计一个算法,为每一个人都分配一件不同的工作,并使总费用达到最小。Input输入有多组数据,每组数据的第一行有1个正整数n(1Output对于每组数据输出一行,这一行只包含一个整数,表示最小费用。Sample Input34 2 52 3 63 4 5原创 2014-08-12 11:17:34 · 592 阅读 · 0 评论 -
How Many Equations Can You Find
Problem DescriptionNow give you an string which only contains 0, 1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9.You are asked to add the sign ‘+’ or ’-’ between the characters. Just like give you a string “12345”, you c原创 2014-09-18 22:38:47 · 496 阅读 · 0 评论 -
K圆
Problem DescriptionA single cycle is a closed simple path, with no other repeated vertices or edges other than the starting and ending vertices. The length of a cycle is the number of vertices on it原创 2014-07-31 10:54:33 · 474 阅读 · 0 评论 -
小珂的工作
描述小珂有一个奶牛场,奶牛场最近在流行D(1输入第一行一个整数M(1输出每组数据输出可以最多挤多少头牛(不换桶),换行结束。样例输入16 3 201 11 21 32 2 12 2 1样例输出5原创 2014-07-22 20:48:45 · 551 阅读 · 0 评论 -
擅长排列的小明
描述小明十分聪明,而且十分擅长排列计算。比如给小明一个数字5,他能立刻给出1-5按字典序的全排列,如果你想为难他,在这5个数字中选出几个数字让他继续全排列,那么你就错了,他同样的很擅长。现在需要你写一个程序来验证擅长排列的小明到底对不对。输入第一行输入整数N(1每组测试数据第一行两个整数 n m (1输出在1-n中选取m个字符进行全排列,按字典序全部输出,每种排列占一行,每原创 2014-06-28 23:10:01 · 419 阅读 · 0 评论 -
How many ways
Problem Description这是一个简单的生存游戏,你控制一个机器人从一个棋盘的起始点(1,1)走到棋盘的终点(n,m)。游戏的规则描述如下:1.机器人一开始在棋盘的起始点并有起始点所标有的能量。2.机器人只能向右或者向下走,并且每走一步消耗一单位能量。3.机器人不能在原地停留。4.当机器人选择了一条可行路径后,当他走到这条路径的终点时,他将只有终点所标记的能量。原创 2014-10-05 17:13:52 · 407 阅读 · 0 评论
分享