AVLVKT - Lovely Kitty

no tags 

Kitty is my sweet sister. Once in a morning I saw she is watching towards the clock. The clock is an analogue clock with two hands. The first one is an hour hand and the other one is a minute hand. While asking about her such attentive mode she replied “Brother can you tell me what will be the angle between the hour hand and the minute hand ?”  I was like “huh!!”. Anyway I solved the problem after a while.

Now here is the task for you. I will give you the angle created between the hour hand and the minute hand. You need to find out the how many organizations of hour and minute hands are there that create such angle. For example if I say 90o then the answer will be – 2. The first one is 03:00 and 9:00.



Note that, the angle calculation should be done in clockwise direction but if you figure out an angle greater than 180o then deduct 180o from it. Because kitty do not understand the calculations of angle more than 180o .


Input starts with an integer T that denotes number of test cases. Each of the next T lines contains a real number with one decimal place that denotes angle A.


1 <= T <= 2000

1 <= A <= 180.0


For each test case print the case number followed by the result according to the following format Case X: R where X denotes the case number and R denotes the result. See the sample for further clarification.





180.0 Output:

Case 1: 2

Case 2: 2

hide comments
Simes: 2019-12-07 11:01:56

Steps to get AC:
1. Write a solution using hours that range between 0 and 11. Use exact minutes only, no seconds.
2. Change the hour range to be 1 to 12, but don't change anything else.
3. Submit.

Yes, this means that all calculated angles between 00:00 and 01:00 are incorrect. For example, angle at 00:00 is 180.0, at 00:01 it's 174.5, continuing down to 4.0 degrees at 00:32.


Last edit: 2019-12-07 12:50:45
Oleg: 2018-12-01 18:38:13

Problem is mess.
Accepted with hour_angle = (hour * 30.0) + minutes * .5; instead of minutes * .25
With if(diff>180) diff=diff-180; - which makes 120 angle at 10:00.

Last edit: 2018-12-01 18:38:29
:D: 2018-10-14 16:27:14

I also don't understand what is being asked in this problem. I tried few assumptions, but all seem to be incorrect. How is the clock "ticking" in full minute intervals or seconds? Do hands move fluently? Do the hour hand move with every minute (as on every digital clock) or only on a full hour? How is the angle being measured: from hour hand to minute hand or is minute hand to hour hand also correct.

Last edit: 2018-10-14 16:28:05
Prateek chandan: 2018-10-10 12:53:59

Please explain the answer for 180.

Also at 10:5454545 minutes, again the clock will be 90 degree. So if we are considering the minutes to be in whole number, i see only 6:00 making 180 degree.

Added by:Avik Sarkar
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)