Simon cannot sleep
Practice
2.7 (65 votes)
Basic programming
Math basic
Basics of implementation
C++
Problem
95% Success 26313 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

It's 12 o'clock at midnight $$(00:00)$$ and Simon cannot sleep! So he decided to stare at the clock on his wall until he falls asleep.

He saw the clock's hands and got to thinking 'How many times they'll pass each other until I fall asleep'. Imagine that he fell asleep at $$hh:mm$$. Now, you must  figure out how many times clock's hands overlap from $$00:00$$ to $$hh:mm$$ (including $$00:00$$ and $$hh:mm$$).

You can see an overlap in the provided picture.

Note: His clock only has an hour and minute hands.

Input format

The first and only line you will get a time in the $$hh:mm$$ format.

$$0 \leq h \leq 23$$

$$0 \leq m \leq 59$$

Output format

Print the number of times that the hour and minute hands pass each other from $$00:00$$ to $$hh:mm$$.

Sample 2

08:36

In this sample, clock's hands overlap 8 times.

Sample 3

03:16

In this sample, clock's hands overlap 3 times.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
9 votes
Tags:
Ad-HocBasic ProgrammingEasy
Points:20
58 votes
Tags:
Ad-HocAlgorithmsApprovedEasyImplementationOpen
Points:20
92 votes
Tags:
Ad-HocApprovedBrute-force searchData StructuresEasyOpen