Logo
(追記) (追記ここまで)

26876번 - New Time 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB36123819365.646%

문제

Nikolay has a digital clock that displays time in 24-hour format, showing two integers: hours (from 00ドル$ to 23ドル$) and minutes (from 00ドル$ to 59ドル$). For example, the clock can show 00:00, 18:42, or 23:59.

The clock has two buttons that can be used for manual adjustment:

  • Button A sets the clock forward by 1ドル$ minute. For example, 05:33 becomes 05:34, 16:59 becomes 17:00, and 23:59 becomes 00:00.
  • Button B sets the clock forward by 1ドル$ hour. For example, 01:42 becomes 02:42, and 23:14 becomes 00:14.

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 hh:mm format (00ドル \le \mathtt{hh} \le 23$; 00ドル \le \mathtt{mm} \le 59$).

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.

제한

예제 입력 1

11:57
12:00

예제 출력 1

3

예제 입력 2

09:09
21:21

예제 출력 2

24

예제 입력 3

19:44
08:50

예제 출력 3

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 12ドル$ times each.

출처

ICPC > Regionals > Northern Eurasia > Northwestern Russia Regional Contest > ICPC 2022-2023 North-Western Russia Regional Contest N번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /