Clock
InterviewTime limit1sMemory limit1024 MB
Given a clock time h and m, find the first moment the hour hand lands on the minute hand's mark, then print that clock time and the elapsed time.
- Level
Easy2 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
A standard analog clock shows exactly hours and minutes. The hour hand points to an integer from 1 to 12, and the minute hand points to an integer from 0 to 59. Both hands move at constant speeds. Mark the exact spot where the minute hand points. At the first moment after that when the hour hand lands exactly on the mark, what do the hands show? Write a program named clock that answers this question.
Input
The first line of standard input contains two integers and , separated by a space.
Output
On the first line of standard output, print the hour and minute shown on the clock as two integers separated by a space. On the second line, print the time elapsed from the starting moment until the hour hand lands exactly on the mark, as two integers (hours and minutes) separated by a space.
Constraints
and .