|
||||||||||
ClockTime 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
Sample Output
Source | ||||||||||
|