F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Clock

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1173    Accepted Submission(s): 453


Problem Description

There is only one Big Clock in the Alibaba¡¯s headquarters on Mars. Since it is on Mars, the Clock is different as it was on Earth.
There are A hours per day and B minutes per hour. The Clock has two hands, the hour hand and the minute hand. The hour hand travels 360 degrees per day and the minute hand travels 360 degrees per hour. Both hands travel consecutively.
But for some reason, the Clock is not very steady. One day the Clock drops off the wall, but fortunately, it is still working. So they plans to put it back onto the wall. But they soon found a problem: it¡¯s the only clock they have, so they don¡¯t know the current time now. Clock only shows the relative position between the two hands, but doesn¡¯t show how to place it (as there are no marks on it), so it can be rotated and represent several different times.
They want your help to determine how many different times the clock may represent.
 

Input
The input consists several testcases.
Every test case only contains one line with two integers A, B (1 <= A,B <= 109) and a real number ¦È (0 < ¦È < 2 ¦Ð), means that there are A hours per day and B minutes per hour, and the minute hand is ¦È rad ahead of the hour hand)
Input ends with one line containing ¡°0 0 0¡±.
 

Output
Print one integer, the number of different times the clock may represent.
 

Sample Input
1 1 1.57 0 0 0
 

Sample Output
0
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-25 12:37:38, Gzip enabled