导航

2013年7月31日

摘要: 点击打开链接子串和时间限制:5000ms | 内存限制:65535KB难度:3描述给定一整型数列{a1,a2...,an},找出连续非空子串{ax,ax+1,...,ay},使得该子序列的和最大,其中,1 max,说明出现了从起始点到当前位置总和出现了新的最大值,那么max = sum;当循环完所有的数,max里面存的就是我们想要的答案,这里有一个陷阱就是如果所有数都小于0,那么上面的办法就会得出一个结果0,这肯定是错误的,整个过程中还要加一段判断如果输入的数是负数,那么就要拿来和max比较一下,如果比max大,那么就max = 这个负数,这样下来如果全是负数,那么就会留下一个最大的负数,而不 阅读全文

posted @ 2013-07-31 09:33 勇敢的炮灰 阅读(304) 评论(0) 推荐(0)

摘要: 点击打开链接24 Point game时间限制:3000ms | 内存限制:65535KB难度:5描述There is a game which is called 24 Point game.In this game , you will be given some numbers. Your task is to find an expression which have all the given numbers and the value of the expression should be 24 .The expression mustn't have any other 阅读全文

posted @ 2013-07-31 09:07 勇敢的炮灰 阅读(403) 评论(0) 推荐(0)