从a点b分到s点t分时针和分针重合多少次?
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
0 1 8 4 1110
分析:
中午12点,墙上挂钟的时针与分针重合了,下次重合应该是:
时针旋转1周,即12小时内,时针和分针重合了11次,且连续两次重合相隔的时间相同;
所以可计算:60*12/11 = 720/11(分钟)
即:下次重合的时间是 1 点 60/11 分 ;
最少经过 720/11 分钟,时针和分针就能重合一次。
代码:
#include<stdio.h> int main() {int a,b,c,d,x,y,t; scanf("%d%d%d%d",&a,&b,&c,&d); while(a!=0||b!=0||c!=0||d!=0) { a%=12; c%=12; x=(a*60+b)*11; y=(c*60+d)*11; if(x>y) y+=720*11; t=y/720-x/720; if(x==0) t++; printf("%d\n",t); scanf("%d%d%d%d",&a,&b,&c,&d); } return 0 ; }