摘要: Problem DescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14.InputThe first line of the input contains an integer T(1<=T<=20) which means the number 阅读全文
posted @ 2014-03-29 23:41 蓝色记忆2013 阅读(106) 评论(0) 推荐(0)
摘要: Problem Description给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ..., Nj },其中 1 using namespace std;int a[10000];int main(){ int k,j; int i; int p,q,p1; int sum,ans; while(cin>>k) { if(k==0) break; sum=0; j=0; p1=0; for(i=0;i>a[i]; if(... 阅读全文
posted @ 2014-03-29 23:38 蓝色记忆2013 阅读(163) 评论(0) 推荐(0)
摘要: Problem DescriptionThe aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because they become too greedy. He has decided to work in the lucrative business of bank robbery only for a short while, before retiring to a comfortabl 阅读全文
posted @ 2014-03-29 23:26 蓝色记忆2013 阅读(586) 评论(0) 推荐(0)
摘要: There is a hill with n holes around. The holes are signed from 0 to n-1.A rabbit must hide in one of the holes. A wolf searches the rabbit in anticlockwise order. The first hole he get into is the one signed with 0. Then he will get into the hole every m holes. For example, m=2 and n=6, the wolf wil 阅读全文
posted @ 2013-11-28 21:32 蓝色记忆2013 阅读(202) 评论(0) 推荐(0)
摘要: Problem Description新年快到了,“猪头帮协会”准备搞一个聚会,已经知道现有会员N人,把会员从1到N编号,其中会长的号码是N号,凡是和会长是老朋友的,那么该会员的号码肯定和N有大于1的公约数,否则都是新朋友,现在会长想知道究竟有几个新朋友?请你编程序帮会长计算出来。Input第一行是测试数据的组数CN(Case number,1#includeusing namespace std;int sushu(int i)//用来判断i是否是素数{ for(int j=2;j>T; while(T--) { cin>>n; sum=n; fo... 阅读全文
posted @ 2013-11-28 20:15 蓝色记忆2013 阅读(132) 评论(0) 推荐(0)
摘要: 七夕节那天,月老来到数字王国,他在城门上贴了一张告示,并且和数字王国的人们说:"你们想知道你们的另一半是谁吗?那就按照告示上的方法去找吧!" 人们纷纷来到告示前,都想知道谁才是自己的另一半.告示如下:数字N的因子就是所有比N小又能被N整除的所有正整数,如12的因子有1,2,3,4,6. 你想知道你的另一半吗?Input输入数据的第一行是一个数字T(1#includeusing namespace std;int main(){ int T; int n,i; int sum; int s; cin>>T; while(T--) { sum=0; ... 阅读全文
posted @ 2013-11-26 20:35 蓝色记忆2013 阅读(186) 评论(0) 推荐(0)
摘要: Problem DescriptionGiven a positive integer N, you should output the most right digit of N^N.InputThe input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow. Each test case contains a single positive integer N(1usin 阅读全文
posted @ 2013-11-24 17:31 蓝色记忆2013 阅读(258) 评论(0) 推荐(0)
摘要: Problem DescriptionEddy's interest is very extensive, recently he is interested in prime number. Eddy discover the all number owned can be divided into the multiply of prime number, but he can't write program, so Eddy has to ask intelligent you to help him, he asks you to write a program whi 阅读全文
posted @ 2013-11-19 17:27 蓝色记忆2013 阅读(171) 评论(0) 推荐(0)
摘要: Kagome Kagome is a Japanese children's game. One child is chosen as the oni (literally demon or ogre, but similar to the concept of "it" in tag) and sits blindfolded (or with their eyes covered). The other children join hands and walk in circles around the oni while singing the song fo 阅读全文
posted @ 2013-11-12 19:38 蓝色记忆2013 阅读(254) 评论(0) 推荐(0)
摘要: Javabeans are delicious. Javaman likes to eat javabeans very much.Javaman has n boxes of javabeans. There are exactly i javabeans in the i-th box (i = 1, 2, 3,...n). Everyday Javaman chooses an integer x. He also chooses several boxes where the numbers of javabeans are all at least x. Then he eats x 阅读全文
posted @ 2013-11-11 11:14 蓝色记忆2013 阅读(166) 评论(0) 推荐(0)