#P13611. [NWRRC 2022] New Time
[NWRRC 2022] New Time
题目描述
Nikolay has a digital clock that displays time in 24-hour format, showing two integers: hours (from to ) and minutes (from to ). For example, the clock can show , , or .
The clock has two buttons that can be used for manual adjustment:
- Button A sets the clock forward by minute. For example, becomes , becomes , and becomes .
- Button B sets the clock forward by hour. For example, becomes , and becomes .
Nikolay has noticed that the time on his clock does not look right. He wants to adjust the clock to the correct time by pressing the buttons as few times as possible.
Find the smallest number of button presses needed to adjust the clock.
输入格式
The first line contains the time shown on the clock in the format (; ).
The second line contains the correct time in the same format.
输出格式
Print a single integer --- the smallest number of button presses Nikolay needs to adjust the time on his clock.
11:57
12:00
3
09:09
21:21
24
19:44
08:50
19
提示
In the first example test, Nikolay can adjust the time by pressing button A three times.
In the second example test, Nikolay should press button A and button B times each.