上一页 1 2 3 4 5 6 ··· 13 下一页
  2012年5月11日
摘要: 时间限制:1000m内存限制:65536kB描述某校大门外长度为L的马路上有一排树,每两棵相邻的树之间的间隔都是1米。我们可以把马路看成一个数轴,马路的一端在数轴0的位置,另一端在L的位置;数轴上的每个整数点,即0,1,2,……,L,都种有一棵树。马路上有一些区域要用来建地铁,这些区域用它们在数轴上的起始点和终止点表示。已知任一区域的起始点和终止点的坐标都是整数,区域之间可能有重合的部分。现在要把这些区域中的树(包括区域端点处的两棵树)移走。你的任务是计算将这些树都移走后,马路上还有多少棵树。输入输入的第一行有两个整数L(1 <= L <= 10000)和 M(1 <= M 阅读全文
posted @ 2012-05-11 20:18 谷堆旁边 阅读(5227) 评论(0) 推荐(0) 编辑
摘要: 时间限制:1000ms内存限制:65536kB描述输入一个英文句子,长度不超过40个字符。编写程序,输出句子中最长的一个单词。输入长度不超过40的字符串输出句中最长的单词样例输入This is a test sentence样例输出sentence提示1.输入只有一个句子,不需使用while2.若句尾有标点,则标点和最后一个单词可看成是一个单词,可以不用作额外判断3.假设句中最长的单词只有一个(1)、源代码:#include<iostream>#include<string>#include<sstream>usingnamespacestd;intmain 阅读全文
posted @ 2012-05-11 20:17 谷堆旁边 阅读(601) 评论(0) 推荐(0) 编辑
摘要: 时间限制:1000ms内存限制:65536kB描述Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land, he learned that the state of Louisiana is actually shrinking by 50 square miles each year, due to erosion caused by the Mississippi River. Since Fred 阅读全文
posted @ 2012-05-11 20:17 谷堆旁边 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 时间限制:1000ms内存限制:65536kB描述Jinjin is a junior school student. Besides the classes in school, Jinjin's mother also arranges some supplementary classes for her. However, if Jinjin studies for more than eight hours a day, she will be unhappy on that day. On any day she gets unhappy, the more time she 阅读全文
posted @ 2012-05-11 20:16 谷堆旁边 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 时间限制:1000ms内存限制:65536kB描述从前有一对长寿兔子,它们每一个月生一对兔子,新生的小兔子两个月就长大了,在第二个月的月底开始生它们的下一代小兔子,这样一代一代生下去,求解兔子增长数量的数列。输入第1行是测试数据的组数n,后面跟着n行输入。每组测试数据占1行,包括一个正整数a(1 <= a <= 20)输出输出有1行,每行输出对应一个输入。输出应是一个正整数序列,整数之间用空格分开。样例输入3321样例输出1 1 21 11(1)、源代码:#include<iostream>#include<vector>usingnamespacestd; 阅读全文
posted @ 2012-05-11 20:16 谷堆旁边 阅读(349) 评论(0) 推荐(0) 编辑
摘要: 时间限制:1000ms内存限制:65536kB描述A certain prison contains a long hall of n cells, each right next to each other. Each cell has a prisoner in it, and each cell is locked.One night, the jailer gets bored and decides to play a game. For round 1 of the game, he takes a drink of whiskey,and then runs down the h 阅读全文
posted @ 2012-05-11 20:15 谷堆旁边 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 时间限制:1000ms内存限制:65536kB描述Zombies love to eat brains. Yum.输入The first line contains a single integer n indicating the number of data sets.The following n lines each represent a data set. Each data set will be formatted according to the following description:A single data set consists of a line " 阅读全文
posted @ 2012-05-11 20:14 谷堆旁边 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 时间限制:1000ms内存限制:65536kB描述输入两个整数X和Y,输出两者之间的素数个数(包括X和Y)。输入两个整数X和Y,X和Y的大小任意。输出输出一个整数,结果可以是0,或大于0的整数。样例输入1 100样例输出25(1)、源代码:#include<iostream>#include<cmath>usingnamespacestd;boolisPrime(inta){inti;if(a == 1)returnfalse;for(i = 2; i <= sqrt(1.0 * a); i++)if(!(a%i))returnfalse;returntrue;} 阅读全文
posted @ 2012-05-11 20:14 谷堆旁边 阅读(926) 评论(0) 推荐(0) 编辑
摘要: 时间限制:1000ms内存限制:65536kB描述输入整数a和b,如果a能被b整除,就输出算式的商,否则输出整数商和余数,如果b=0,输出error。输入整数a和整数b输出商或者商和余数或者error样例输入100 1075 201 0样例输出103 15error(1)、源代码:#include<iostream>usingnamespacestd;intmain(){ints, t, a, b;while(cin >> a >> b){if(0 == b)cout <<"error\n";elseif(a%b)cout & 阅读全文
posted @ 2012-05-11 20:13 谷堆旁边 阅读(434) 评论(0) 推荐(0) 编辑
摘要: 时间限制:1000ms内存限制:65536kB描述矩阵int a[3][3],矩阵int b[3][3]。矩阵的数据由用户输入。输出新的矩阵c=a+b. 输出格式:c00 c01 c02c10 c11 c12c20 c21 c22每个元素占4位。输入矩阵aa00 a01 a02a10 a11 a12a20 a21 a22矩阵bb00 b01 b02b10 b11 b12b20 b21 b22输出矩阵cc00 c01 c02c10 c11 c12c20 c21 c22样例输入1 2 34 5 67 8 97 8 9 4 5 61 2 3样例输出 8 10 12 8 10 12 ... 阅读全文
posted @ 2012-05-11 20:13 谷堆旁边 阅读(488) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 13 下一页