2012年8月11日
摘要: DescriptionFor the daily milking, Farmer John'sNcows (1 ≤N≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the cows. To keep things simple, he will take a contiguous range of cows from the milking lineup to play the game. 阅读全文
posted @ 2012-08-11 17:58 crying_Dream 阅读(167) 评论(0) 推荐(0)
摘要: DescriptionSome of Farmer John'sNcows (1 ≤N≤ 80,000) are having a bad hair day! Since each cow is self-conscious about her messy hairstyle, FJ wants to count the number of other cows that can see the top of other cows' heads.Each cowihas a specified heighthi(1 ≤hi≤ 1,000,000,000) and is stan 阅读全文
posted @ 2012-08-11 15:21 crying_Dream 阅读(493) 评论(0) 推荐(0)
摘要: DescriptionAn array of sizen≤ 106is given to you. There is a sliding window of sizekwhich is moving from the very left of the array to the very right. You can only see theknumbers in the window. Each time the sliding window moves rightwards by one position. Following is an example:The array is[13-1- 阅读全文
posted @ 2012-08-11 11:02 crying_Dream 阅读(160) 评论(0) 推荐(0)
摘要: Description输入一个长度为n的整数序列(A1,A2,……,An),从中找出一段连续的长度不超过m的子序列,使得这个子序列的和最大。Input有多组测试数据,不超过20组测试数据。对于每组测试的第一行,包含两个整数n和m(n,m<=10^5),表示有n个数,子序列长度限制为m,表示这个序列的长度,第二行为n个数,每个数的范围为[-1000, 1000]。Output对于每组测试数据,输出最大的子序列和,并换行。Sample Input3 11 2 33 2-1000 1000 1Sample Output31001思路:看的比较懂得参考资料:http://blog.csdn.ne 阅读全文
posted @ 2012-08-11 10:58 crying_Dream 阅读(341) 评论(0) 推荐(0)