时钟
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1961 Accepted Submission(s): 528
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 8 0 0 0 0
Sample Output
0 1 8 4 11 10
Author
zhousc
Source
Recommend
对这道题很无语。。。
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
int a,b,s,t,time;
while(scanf("%d%d%d%d",&a,&b,&s,&t),a+b+s+t)
{
a=a%12;
s=s%12;
int s1=(a*60+b)*11;
int s2=(s*60+t)*11;
if(s2<s1)
s2+=720*11;
time=s2/720-s1/720;
if(s1==0)
time++;
printf("%d\n",time);
}
return 0;
}