Given time in HH MM SS format and you have to find what will be time after hour hand moves by x degrees.
EXPLANATION:
If hour hand moves by 1 degree then 2 minutes will happen in 12 hour clock. As x is integer and smallest change in x can be only 1 degree hence
second hand will come to its original position whatever may be the value of x i.e SS field will not change.
Now find if minutes to add in MM field is greater than 60 or not . If final MM field > 60 then add extra minutes in hour by converting minutes to
hour.
Note : if x > 360 that means hour hand has moved by more than 360 degrees i.e several complete rotations have happened.
so to solve one can do x = x%360 which will have same effect.
Possible testcases where you may get wrong answers:
The preliminary step here is to find out what 1 degree motion of the hour hand means in terms of time. 0ne full rotation of the hour hand is 12 hours or 12\times 60 = 720 minutes, and conveniently we have 720/360 = 2 exactly; giving 2 minutes per degree.
If, instead of degrees, the question had asked the time after the hour hand is moved by xgradians, which have 400 for a full turn, we would have had to go down to an effect in seconds, with 720\times 60 = 43200 second in a full turn of the hour hand and thus 108 seconds per gradian.
@joffan Thanks for your suggestion about use of gradians in problem . But I wanted to design an easy problem So I deliberately made a special case in which that it turns out that 1 degree corresponds to 2 minutes.