Problem Description 水题 Input 输入2个日期,日期按照年月日,年月日之间用符号-隔开(题目包含多组数据) Output 求出这2个日期之间的天数(不包括自身),每组测试数据一行 Sample Input 2011-1-1 2011-1-5 Sample Output 3 HINT 为了简单之见,本题假设输入的是同年同月的2个日期,且第一个日期小于第2个日期 #include<stdio.h> int main() { int y1,m1,d1,y2,m2,d2; wh…
#include<stdio.h> int main() { int a1,b1,c1,a2,b2,c2,s; scanf("%d-%d-%d",&a1,&b1,&c1); scanf("%d-%d-%d",&a2,&b2,&c2); s=c2-c1-; printf("%d",s); ; }…
#include<stdio.h> int main() { int a1,b1,a2,b2,s; scanf("%d:%d",&a1,&b1); scanf("%d:%d\n",&a2,&b2); s=b2-b1-; printf("%d",s); ; }…
Problem Description 输入三个整数,分别代表三角形的三条边长度,判断能否构成直角三角形 Input 输入3个整数a,b,c(多组数据,-5000000<a,b,c<5000000) Output 如果能组成直角三角形,输出yes否则输出no Sample Input 3 4 5 Sample Output yes #include <stdio.h> int main() { int a, b, c; while(scanf("%d%d%d",…
Problem Description 有一头母牛,它每年年初生一头小母牛.每头小母牛从第四个年头开始,每年年初也生一头小母牛.请编程实现在第n年的时候,共有多少头母牛? Input 输入数据由多个测试实例组成,每个测试实例占一行,包括一个整数n(0<n<55),n的含义如题目中描述. n=0表示输入数据的结束,不做处理. Output 对于每个测试实例,输出在第n年的时候母牛的数量. 每个输出占一行. Sample Input 2 4 5 0 Sample Output 2 4 6 HINT…
Problem Description 有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行.请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数. 其中,蜂房的结构如下所示. Input 输入数据的第一行是一个整数N,表示测试实例的个数,然后是N 行数据,每行包含两个整数a和b(0<a<b<50). Output 对于每个测试实例,请输出蜜蜂从蜂房a爬到蜂房b的可能路线数,每个实例的输出占一行. Sample Input 2 1 2 3 6 Sample Output 1 3 #inclu…
Problem Description 输入平面坐标系中2点的坐标,输出它们之间的距离 Input 输入4个浮点数x1 y1 x2 y2,分别是点(x1,y1) (x2,y2)的坐标(多组数据) Output 输出它们之间的距离,保留2位小数(每组数据一行) Sample Input 1 0 2 0 Sample Output 1.00 #include<stdio.h> #include<math.h> int main() { float x1,y1,x2,y2; double…
Problem Description 输入一个正整数n(n<=10),计算 S=1!+2!+3!+...+n! Input 输入一个正整数n(n<=10)(多组数据) Output 输出S(每组数据一行) Sample Input 2 Sample Output 3 #include<stdio.h> int main() { long int s,a; int i,n; while(scanf("%d",&n)!=EOF) { s=; a=; ;i&…
#include<stdio.h> #include <math.h> int main() { int n; ); double a,b; while(scanf("%d",&n)!=EOF) a=sin(n*pi/); b=cos(n*pi/); printf("%.2f\n%.2f\n",a,b); ; }…
#include<stdio.h> int main() { int a,b,c; scanf("%d %d %d",&a,&b,&c); printf("%.3f\n",(a+b+c)/3.0); ; }…