上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 19 下一页
摘要: Problem DescriptionProblems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will be analyzing a property of an algorithm whose classification is not known for all possible inputs.Consider the following algor. 阅读全文
posted @ 2013-05-01 21:16 forevermemory 阅读(90) 评论(0) 推荐(0) 编辑
摘要: DescriptionA lattice point (x, y) in the first quadrant (x and y are integers greater than or equal to 0), other than the origin, is visible from the origin if the line from (0, 0) to (x, y) does not pass through any other lattice point. For example, the point (4, 2) is not visible since the line fr 阅读全文
posted @ 2013-05-01 19:31 forevermemory 阅读(253) 评论(0) 推荐(0) 编辑
摘要: DescriptionGiven n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if there are no integers x > 1, y > 0, z > 0 such that a = xy and b = xz.InputThere are several test cases. For each test case, standard input 阅读全文
posted @ 2013-05-01 16:58 forevermemory 阅读(258) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionLong, long ago, country A invented a missile system to destroy the missiles from their enemy. That system can launch only one missile to destroy multiple missiles if the heights of all the missiles form a non-decrease sequence. But recently, the scientists found that the system is 阅读全文
posted @ 2013-04-21 23:30 forevermemory 阅读(368) 评论(0) 推荐(0) 编辑
摘要: Problem Description给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ..., Nj },其中 1 <= i <= j <= K。最大连续子序列是所有连续子序列中元素和最大的一个, 例如给定序列{ -2, 11, -4, 13, -5, -2 },其最大连续子序列为{ 11, -4, 13 },最大和 为20。 在今年的数据结构考卷中,要求编写程序得到最大和,现在增加一个要求,即还需要输出该 子序列的第一个和最后一个元素。Input测试输入包含若干测试用例,每个测试用例占2行,第1行给出正整数K( &l 阅读全文
posted @ 2013-04-19 22:17 forevermemory 阅读(420) 评论(0) 推荐(0) 编辑
摘要: Problem Description这是一个简单的生存游戏,你控制一个机器人从一个棋盘的起始点(1,1)走到棋盘的终点(n,m)。游戏的规则描述如下: 1.机器人一开始在棋盘的起始点并有起始点所标有的能量。 2.机器人只能向右或者向下走,并且每走一步消耗一单位能量。 3.机器人不能在原地停留。 4.当机器人选择了一条可行路径后,当他走到这条路径的终点时,他将只有终点所标记的能量。如上图,机器人一开始在(1,1)点,并拥有4单位能量,蓝色方块表示他所能到达的点,如果他在这次路径选择中选择的终点是(2,4)点,当他到达(2,4)点时将拥有1单位的能量,并开始下一次路径选择,直到到达(6,6)点。 阅读全文
posted @ 2013-04-18 23:58 forevermemory 阅读(195) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionWXYZ很喜欢吃绿豆饼,而且每次都能吃很多。但是担心WXYZ长的太胖,妈妈把买回来的一卷卷的绿豆饼排成一列(每卷绿豆饼的高度可能是不一样的),规定WXYZ只能取其中一段连续的并且高度严格上升的绿豆饼来吃。 可怜的WXYZ发现,根据这个规则,每次他只能拿到很少的绿豆饼,于是他想到了一个办法:趁妈妈不注意的时候改变某一卷绿豆饼的高度(压扁或拉长它)。WXYZ知道,这样就可以拿到一段长得多的连续的而且高度严格上升的绿豆饼了。 真是太聪明了!不过应该改变哪一卷绿豆饼的高度才能使得可以拿走的连续的一段高度严格上升的绿豆饼最多呢?嗯,这个问题就交给你了,如果你能成功解 阅读全文
posted @ 2013-04-18 22:58 forevermemory 阅读(372) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionLong long ago, city Old was all around the water and was divided into M*N small square houses. The city Old had only two bridges, in the southwest corner and northeast corner. It’s obvious that the citizens can have C(m+n, n) different ways with shortest length, to go from one bri 阅读全文
posted @ 2013-04-15 22:41 forevermemory 阅读(244) 评论(0) 推荐(0) 编辑
摘要: Problem Description穿过幽谷意味着离大魔王lemon已经无限接近了! 可谁能想到,yifenfei在斩杀了一些虾兵蟹将后,却再次面临命运大迷宫的考验,这是魔王lemon设下的又一个机关。要知道,不论何人,若在迷宫中被困1小时以上,则必死无疑! 可怜的yifenfei为了去救MM,义无返顾地跳进了迷宫。让我们一起帮帮执着的他吧! 命运大迷宫可以看成是一个两维的方格阵列,如下图所示: yifenfei一开始在左上角,目的当然是到达右下角的大魔王所在地。迷宫的每一个格子都受到幸运女神眷恋或者痛苦魔王的诅咒,所以每个格子都对应一个值,走到那里便自动得到了对应的值。 现在规定yife. 阅读全文
posted @ 2013-04-09 01:09 forevermemory 阅读(119) 评论(0) 推荐(0) 编辑
摘要: Problem Description都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏中是个身手敏捷的高手,但在现实中运动神经特别迟钝,每秒种只有在移动不超过一米的范围内接住坠落的馅饼。现在给这条小径如图标上坐标:为了使问题简化,假设在接下来的一段时间里,馅饼都掉落在0-10这11个位置。开始时 阅读全文
posted @ 2013-04-08 00:37 forevermemory 阅读(103) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 19 下一页