摘要: 做了A+B Problem之后,Yougth感觉太简单了,于是他想让你求出两个数反转后相加的值。帮帮他吧输入有多组测试数据。每组包括两个数m和n,数据保证int范围,当m和n同时为0是表示输入结束。输出输出反转后相加的结果。样例输入1234 1234125 1170 0样例输出86421232#includeint main(){int m,n;while(scanf("%d %d",&m,&n),m!=0&&n!=0){int a=0,b=0;while(m>0){a=a*10+m%10;m/=10;}while(n>0){b= 阅读全文
posted @ 2014-02-24 21:48 为梦出发 阅读(490) 评论(0) 推荐(0) 编辑
摘要: 大家都知道阶乘这个概念,举个简单的例子:5!=1*2*3*4*5.现在我们引入一种新的阶乘概念,将原来的每个数相乘变为i不大于n的所有奇数相乘例如:5!!=1*3*5.现在明白现在这种阶乘的意思了吧!现在你的任务是求出1!!+2!!......+n!!的正确值(nint main(){int test,t,s;scanf("%d",&test);while(test--){int m,i,p=0;scanf("%d",&m);for(i=1;i<=m;i++){ s=1; for(t=1;t<=i;t+=2){s*=t;}p+ 阅读全文
posted @ 2014-02-24 20:28 为梦出发 阅读(695) 评论(0) 推荐(0) 编辑
摘要: 话说MCA山上各路豪杰均出山抗敌,去年曾在江湖威名显赫的,江湖人称的甘露也不甘示弱,“天将降大任于斯人也,必先劳其筋骨,饿其体肤,空乏其身”他说。可惜,由于去年取上将首级时不慎右手右关节第七次骨折,养伤达一年之久,空有一腔抱负却壮志难酬,如今天下危亡,习武之人又怎能袖手旁观,于是他决定出山协助威士忌共抗辽贼,这时他的对头枫冰叶子出现,两人都是水属性,但由于十年前的一场恩怨(这是后话)势成水火。枫冰叶子要求甘露回答一个问题,否则不让他离开,可惜甘露绞尽脑汁未果,希望你来帮他解决,助他完成大业。问题是这样的:给你一个小数x,让你算出小数点后第n位是什么,(1 #includeint main(){ 阅读全文
posted @ 2014-02-22 22:02 为梦出发 阅读(355) 评论(1) 推荐(0) 编辑
摘要: gets() 函数 【1】函数:gets(字符指针) 【2】头文件:stdio.h(c中),c++不需包含此头文件 【3】原型:char *gets( char *buffer ); 【4】功能:从stdio流中读取字符串,直至接受到换行符或EOF时停止,并将读取的结果存放在buffer指针所指向的字符数组中。换行符不作为读取串的内容,读取的换行符被转换为null值,并由此来结束字符串。 【5】注意:本函数可以无限读取,不会判断上限,所以程序员应该确保str的空间足够大,以便在执行读操作时不发生溢出。如果溢出,多出来的字符将被写入到缓冲区后面的内存位置,这将破坏一个或多个... 阅读全文
posted @ 2014-02-22 15:26 为梦出发 阅读(7514) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionYour task is to calculate the sum of some integers.InputInput contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line.OutputFor each group of input integers you should output their sum in one 阅读全文
posted @ 2014-02-22 15:01 为梦出发 阅读(2041) 评论(0) 推荐(0) 编辑
摘要: Problem Description多项式的描述如下: 1 - 1/2 + 1/3 - 1/4 + 1/5 - 1/6 + ... 现在请你求出该多项式的前n项的和。Input输入数据由2行组成,首先是一个正整数m(mint main(){int test;scanf("%d",&test);while(test--){int n,i,f=-1;double s=0; scanf("%d",&n); for(i=1;i<n+1;) { double m; f=-f; m=1.0/i*f; s+=m; i++; } printf(& 阅读全文
posted @ 2014-02-22 14:05 为梦出发 阅读(434) 评论(0) 推荐(0) 编辑
摘要: Problem 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 easy the prob 阅读全文
posted @ 2014-02-22 00:41 为梦出发 阅读(635) 评论(0) 推荐(0) 编辑
摘要: Problem Description给定一个日期,输出这个日期是该年的第几天。Input输入数据有多组,每组占一行,数据格式为YYYY/MM/DD组成,具体参见sample input ,另外,可以向你确保所有的输入数据是合法的。Output对于每组输入数据,输出一行,表示该日期是该年的第几天。Sample Input1985/1/202006/3/12Sample Output2071#includeint main(){int y,m,d,i;int t[]={31,28,31,30,31,30,31,31,30,31,30,31};while(scanf("%d/%d/%d& 阅读全文
posted @ 2014-02-21 23:52 为梦出发 阅读(291) 评论(0) 推荐(0) 编辑
摘要: Problem Description统计给定的n个数中,负数、零和正数的个数。Input输入数据有多组,每组占一行,每行的第一个数是整数n(nint main(){double a[100];int i,test;while(scanf("%d",&test),test){int t=0,m=0,d=0;for(i=0;i0) d++;} printf("%d %d ",t,m);printf("%d\n",d);}return 0;} 阅读全文
posted @ 2014-02-21 22:50 为梦出发 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 新的一年到来了! 刚刚过去的一年里,我已浪费很多时光!新年新气象,为避免重蹈覆辙,此时我必须要立个新年计划,马年计划!(1)一天必须做两道ACM题。(2)每周一个总结报告,14道ACM题必须清零。(3)每月一次心得感悟,对过去的题集进行复查。IT乞丐,坚持做好每一道题! 业精于勤荒于嬉,行成于思毁于随。 阅读全文
posted @ 2014-02-21 22:49 为梦出发 阅读(111) 评论(0) 推荐(0) 编辑