Reverse Clock Hand

Dreamy_Idler Replay of UAP CSE Intra D...
Limits 1s, 1.0 GB

There is a boy in University of Asia Pacific, named “N”. He doesn’t like to read books, but very much curious about doing something creative. One day his mother notice that, the minute hand of the wall clock in N’s room as usual rotated clockwise but the hour hand rotated anticlockwise. She knows that, this is done by her son. She asks her son, why he has done that & how can he find the actual time?
Instead of answering her question, he told his mother, “If I give u the position of the minute hand, and the angle between the minute hand and the hour hand of the clock, can you tell me the actual time?”
His mother doesn’t like to do that kind of silly thing and you are a good problem solver. So she give you this problem to solve.


The first line of the input contains a single integer t(1 ≤ t ≤ 100), denoting the number of test cases.
Each test case contains two integers p(0 ≤ p ≤ 59), q(0 ≤ q ≤ 359)-the position of the minute hand (which min the hand indicate at) and the clockwise angle between the two hands (between right side of the minute hand and left side of the hour hand). Consider the angle in degrees.


For every test case print one line of output, that contain the actual time. Both hour and minute must represent in two digit and separated by a colon. For more clearance follow the examples.
Note: Hours are count as 12,1,2,3,4,5,6,7,8,9,10,11.


10 85
30 315


Login to submit.


59% Solution Ratio
RenegadesEarliest, Jan '18
shadhin01Fastest, 0.0s
RenegadesLightest, 131 kB
user.318372Shortest, 371B
Toph uses cookies. By continuing you agree to our Cookie Policy.