摘要: Problem Description 春天是鲜花的季节,水仙花就是其中最迷人的代表,数学上有个水仙花数,他是这样定义的:“水仙花数”是指一个三位数,它的各位数字的立方和等于其本身,比如:153=1^3+5^3+3^3。现在要求输出所有在m和n范围内的水仙花数。 Input 输入数据有多组,每组占一 阅读全文
posted @ 2019-03-31 19:42 pipiforever 阅读(447) 评论(0) 推荐(0) 编辑
摘要: Problem Description 数列的定义如下:数列的第一项为n,以后各项为前一项的平方根,求数列的前m项的和。 Input 输入数据有多组,每组占一行,由两个整数n(n<10000)和m(m<1000)组成,n和m的含义如前所述。 Output 对于每组输入数据,输出该数列的和,每个测试实 阅读全文
posted @ 2019-03-31 19:41 pipiforever 阅读(276) 评论(0) 推荐(0) 编辑
摘要: Problem Description 统计给定的n个数中,负数、零和正数的个数。 Input 输入数据有多组,每组占一行,每行的第一个数是整数n(n<100),表示需要统计的数值的个数,然后是n个实数;如果n=0,则表示输入结束,该行不做处理。 Output 对于每组输入数据,输出一行a,b和c, 阅读全文
posted @ 2019-03-31 19:40 pipiforever 阅读(318) 评论(0) 推荐(0) 编辑
摘要: 给定一段连续的整数,求出他们中所有偶数的平方和以及所有奇数的立方和。 Input 输入数据包含多组测试实例,每组测试实例包含一行,由两个整数m和n组成。 Output 对于每组输入数据,输出一行,应包括两个整数x和y,分别表示该段连续的整数中所有偶数的平方和以及所有奇数的立方和。你可以认为32位整数 阅读全文
posted @ 2019-03-31 16:02 pipiforever 阅读(439) 评论(0) 推荐(0) 编辑
摘要: #include #include int main() { int i,n,a; int sum = 1; while(scanf("%d",&n)!=EOF) { for(i=0;i<n;i++) {scanf("%d",&a); if(a%2!=0) ... 阅读全文
posted @ 2019-03-31 15:57 pipiforever 阅读(266) 评论(0) 推荐(0) 编辑
摘要: Problem Description 给定一个日期,输出这个日期是该年的第几天。 Input 输入数据有多组,每组占一行,数据格式为YYYY/MM/DD组成,具体参见sample input ,另外,可以向你确保所有的输入数据是合法的。 Output 对于每组输入数据,输出一行,表示该日期是该年的 阅读全文
posted @ 2019-03-31 15:56 pipiforever 阅读(391) 评论(0) 推荐(0) 编辑
摘要: #include #include int main() { int score; while(scanf("%d",&score)!=EOF) { if(score100) printf("Score is error!\n"); if(score>=90&&score=80&&score=70&&score... 阅读全文
posted @ 2019-03-31 15:50 pipiforever 阅读(314) 评论(0) 推荐(0) 编辑
摘要: #include #include #define PI 3.1415927 int main() { double r,v; while(scanf("%lf",&r)!=EOF) { v = PI*r*r*r*4/3; printf("%.3lf\n",v); } return 0; } 阅读全文
posted @ 2019-03-31 15:47 pipiforever 阅读(186) 评论(0) 推荐(0) 编辑
摘要: #include #include int main() { double a,b; while(scanf("%lf",&a)!=EOF) { if(a>=0.00) printf("%.2lf\n",a); else printf("%.2lf\n",-a); } r... 阅读全文
posted @ 2019-03-31 15:47 pipiforever 阅读(218) 评论(0) 推荐(0) 编辑
摘要: #include #include #include int main() { double x1,x2,y1,y2,dis; while(scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2)!=EOF) { dis = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); prin... 阅读全文
posted @ 2019-03-31 15:45 pipiforever 阅读(300) 评论(0) 推荐(0) 编辑
摘要: #include #include int main() { char a,b,c,t; while(scanf("%c%c%c",&a,&b,&c)!=EOF) { getchar();//一定要有这一行,因为scanf在接收字符串时,会把换行键一起接收,这里需要用getchar来吸收换行键。 if(a>b) ... 阅读全文
posted @ 2019-03-31 15:43 pipiforever 阅读(324) 评论(0) 推荐(0) 编辑