摘要: The 3n+ 1 problemBackgroundProblems 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.The ProblemConsider t 阅读全文
posted @ 2011-04-13 23:01 cpoint 阅读(248) 评论(0) 推荐(0) 编辑
摘要: #include<time.h>clock_tstart,end;doubleduration;start=clock();//dosomethingend=clock();duration=(double)(end-start)/CLOCKS_PER_SEC;//秒 阅读全文
posted @ 2011-04-13 22:44 cpoint 阅读(496) 评论(0) 推荐(0) 编辑
摘要: 汉字统计Problem Description统计给定文本文件中汉字的个数。Input输入文件首先包含一个整数n,表示测试实例的个数,然后是n段文本。Output对于每一段文本,输出其中的汉字的个数,每个测试实例的输出占一行。[Hint:]从汉字机内码的特点考虑~Sample Input2 WaHaHa! WaHaHa! 今年过节不说话要说只说普通话WaHaHa! WaHaHa! 马上就要期末考试了Are you ready?Sample Output14 9AC code:#include<stdio.h>#include<math.h>#include<cty 阅读全文
posted @ 2011-04-13 22:35 cpoint 阅读(491) 评论(0) 推荐(0) 编辑
摘要: 人见人爱A-BProblem Description参加过上个月月赛的同学一定还记得其中的一个最简单的题目,就是{A}+{B},那个题目求的是两个集合的并集,今天我们这个A-B求的是两个集合的差,就是做集合的减法运算。(当然,大家都知道集合的定义,就是同一个集合中不会有两个相同的元素,这里还是提醒大家一下)呵呵,很简单吧?Input每组输入数据占1行,每行数据的开始是2个整数n(0<=n<=100)和m(0<=m<=100),分别表示集合A和集合B的元素个数,然后紧跟着n+m个元素,前面n个元素属于集合A,其余的属于集合B. 每个元素为不超出int范围的整数,元素之间有 阅读全文
posted @ 2011-04-13 22:26 cpoint 阅读(690) 评论(0) 推荐(0) 编辑
摘要: 整除的尾数Problem Description一个整数,只知道前几位,不知道末二位,被另一个整数除尽了,那么该数的末二位该是什么呢?Input输入数据有若干组,每组数据包含二个整数a,b(0<a<10000, 10<b<100),若遇到0 0则处理结束。Output对应每组数据,将满足条件的所有尾数在一行内输出,格式见样本输出。同组数据的输出,其每个尾数之间空一格,行末没有空格。Sample Input200 401992 950 0Sample Output00 40 8015AC code:#include<stdio.h>intmain(){inta 阅读全文
posted @ 2011-04-13 22:16 cpoint 阅读(777) 评论(1) 推荐(0) 编辑
摘要: 绝对值排序Problem Description输入n(n<=100)个整数,按照绝对值从大到小排序后输出。题目保证对于每一个测试实例,所有的数的绝对值都不相等。Input输入数据有多组,每组占一行,每行的第一个数字为n,接着是n个整数,n=0表示输入数据的结束,不做处理。Output对于每个测试实例,输出排序后的结果,两个数之间用一个空格隔开。每个测试实例占一行。Sample Input3 3 -4 24 0 1 2 -30Sample Output-4 3 2-3 2 1 0AC code:#include<stdio.h>#include<math.h>#i 阅读全文
posted @ 2011-04-13 22:05 cpoint 阅读(597) 评论(0) 推荐(0) 编辑
摘要: 第几天?Problem Description给定一个日期,输出这个日期是该年的第几天。Input输入数据有多组,每组占一行,数据格式为YYYY/MM/DD组成,具体参见sample input ,另外,可以向你确保所有的输入数据是合法的。Output对于每组输入数据,输出一行,表示该日期是该年的第几天。Sample Input1985/1/202006/3/12Sample Output2071AC code:#include<stdio.h>#include<math.h>intisleapyear(inty){if(((y%4==0)&&(y%10 阅读全文
posted @ 2011-04-13 22:00 cpoint 阅读(569) 评论(0) 推荐(0) 编辑
摘要: ASCII码排序Problem Description输入三个字符后,按各字符的ASCII码从小到大的顺序输出这三个字符。Input输入数据有多组,每组占一行,有三个字符组成,之间无空格。Output对于每组输入数据,输出一行,字符中间用一个空格分开。Sample InputqweasdzxcSample Outpute q wa d sc x zAC code:#include<stdio.h>#include<string.h>#defineN3voidswap(char*a,char*b){chartemp;temp=*a;*a=*b;*b=temp;}voids 阅读全文
posted @ 2011-04-13 21:54 cpoint 阅读(1319) 评论(0) 推荐(0) 编辑
摘要: Climbing WormProblem DescriptionAn inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches every minute, but then has to rest a minute before climbing again. During the rest, it slips down d inches. The process of climbing and resting then repeats. How long before 阅读全文
posted @ 2011-04-13 21:41 cpoint 阅读(472) 评论(0) 推荐(0) 编辑
摘要: An Easy TaskProblem DescriptionIgnatius was born in a leap year, so he want to know when he could hold his birthday party. Can you tell him?Given a positive integers Y which indicate the start year, and a positive integer N, your task is to tell the Nth leap year from year Y.Note: if year Y is a lea 阅读全文
posted @ 2011-04-13 21:35 cpoint 阅读(718) 评论(0) 推荐(0) 编辑
摘要: Train Problem IProblem DescriptionAs the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by train(because the trains in the Ignatius Train Station is the fastest all over the world ^v^). But here comes a problem, there is only one railway 阅读全文
posted @ 2011-04-13 21:28 cpoint 阅读(1430) 评论(0) 推荐(0) 编辑
摘要: As Easy As A+BProblem DescriptionThese days, I am thinking about a question, how can I get a problem as easy as A+B? It is fairly difficulty to do such a thing. Of course, I got it after many waking nights.Give you some integers, your task is to sort these number ascending (升序).You should know how e 阅读全文
posted @ 2011-04-13 21:20 cpoint 阅读(831) 评论(0) 推荐(0) 编辑
摘要: Least Common MultipleProblem DescriptionThe least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5, 7 and 15 is 105.InputInput will consist of multiple problem instances. The first line of 阅读全文
posted @ 2011-04-13 21:17 cpoint 阅读(408) 评论(0) 推荐(0) 编辑
摘要: 最小公倍数Problem Description给定两个正整数,计算这两个数的最小公倍数。Input输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.Output对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。Sample Input10 14Sample Output70SourcePOJRecommendEddyAC code:#include<stdio.h>#include<math.h>intgcd(inta,intb)//求最大公约数函数{intr;while(b){r=a%b;a=b;b=r;}returna;}intmai 阅读全文
posted @ 2011-04-13 21:12 cpoint 阅读(562) 评论(0) 推荐(0) 编辑
摘要: A hard puzzleProblem Descriptionlcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a and b,how to know the a^b.everybody objects to this BT problem,so lcy makes the problem easier than begin.this puzzle describes that: gave a and b,how to know the a^b's the last digit number.Bu 阅读全文
posted @ 2011-04-13 21:10 cpoint 阅读(386) 评论(0) 推荐(0) 编辑
摘要: N!Problem DescriptionGiven an integer N(0 ≤ N ≤ 10000), your task is to calculate N!InputOne N in one line, process to the end of file.OutputFor each N, output N! in one line.Sample Input123Sample Output126AuthorJGShining(极光炫影)AC code:#include<stdio.h>intmain(){inta[10000];inti,j,c,m,n;while(s 阅读全文
posted @ 2011-04-13 21:07 cpoint 阅读(596) 评论(0) 推荐(0) 编辑
摘要: u Calculate eProblem DescriptionA simple mathematical formula for e iswhere n is allowed to go to infinity. This can actually yield very accurate approximations of e using relatively small values of n.OutputOutput the approximations of e generated by the above formula for the values of n from 0 to 9 阅读全文
posted @ 2011-04-13 21:04 cpoint 阅读(466) 评论(0) 推荐(0) 编辑
摘要: Fibonacci AgainProblem DescriptionThere are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2).InputInput consists of a sequence of lines, each containing an integer n. (n < 1,000,000).OutputPrint the word "yes" if 3 divide evenly into F(n).Print th 阅读全文
posted @ 2011-04-13 20:58 cpoint 阅读(380) 评论(0) 推荐(0) 编辑
摘要: ElevatorProblem DescriptionThe highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4 seconds to move down one fl 阅读全文
posted @ 2011-04-13 20:52 cpoint 阅读(344) 评论(0) 推荐(0) 编辑
摘要: Number SequenceProblem DescriptionA number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given A, B, and n, you are to calculate the value of f(n).InputThe input consists of multiple test cases. Each test case contains 3 integers A, B and n on a single 阅读全文
posted @ 2011-04-13 20:50 cpoint 阅读(382) 评论(0) 推荐(0) 编辑
浏览次数:travelocity promotion codes