hdoj--2180--时钟(数学)

来源:互联网 发布:板式家具折单软件 编辑:程序博客网 时间:2024/06/05 07:16

时钟

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1735    Accepted Submission(s): 440


Problem Description
从a点b分到s点t分时针和分针重合多少次?
 

Input
有多组数据,每组1行4个数 a,b,s,t. 1<=a,s <=12, 0<=b,t<60. 0 0 0 0结束.
 

Output
参看Sample output
 

Sample Input
12 50 1 2 3 8 3 20 2 45 11 0 11 0 3 20 1 2 12 50 3 20 3 80 0 0 0
 

Sample Output
01841110
 

Author
zhousc
 

Source
ECJTU 2008 Summer Contest
 

#include<stdio.h>#include<string.h>int main(){int a,aa,b,bb;int x,y;while(scanf("%d%d%d%d",&a,&aa,&b,&bb),a||b||aa||bb){a%=12;b%=12;x=(a*60+aa)*11;y=(b*60+bb)*11;if(y<x)y+=720*11;int cnt=y/720-x/720;if(x==0)cnt++;printf("%d\n",cnt);}return 0;}


0 0
原创粉丝点击