루미 알고리즘

#1277골드The Clock

PO 2004 학교 예선코딩영어 원문이 문제가 어렵다면 — 배우는 순서 보기

영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)

Problem

When someone asks you what time it is, most people respond “a quarter past five”, 15:29 or something similar. If you want to make things a bit harder, you can answer with the angle from the minute hand to the hour hand, since this uniquely determines the time. However, most people are not used to this way of specifying the time, so it would be nice to have a program which translates this to a more common format. Your task is to write such a program.

(그림은 원문 저장소에서 볼 수 있습니다)

Figure 1: The time on the left is 01:21. On the right, it is 03:08.

We assume that our clock has no second hand, and only displays the time at whole minutes (i.e., both hands only move forward once a minute). The angle is determined by starting at the hour hand and measuring the number of degrees clockwise to the minute hand. To avoid decimals, this angle is specified in tenths of a degree (so that 85.5 degrees is written as 855). This number is always an integer between 0 and 3595 (inclusive) and is, as a consequence of only measuring whole minutes, evenly divisible by 5.

Input

The input consists of a single integer between 0 and 3595 – the angle between the two hands, in tenths of a degree.

Output

Output the time that the angle corresponds to, in the format hh:mm. We assume that it's morning, so all times should be between 00:00 and 11:59.

Scoring

Your solution will be tested on three cases. The first two give you 33 points each, while the last gives you 34.

예제

예제 1

입력
855
출력
01:21

예제 2

입력
3140
출력
03:08

출처 표기

출처: Programmeringsolympiaden 2004년 학교 예선 · 원문 페이지 · 이용 조건 CC BY-SA · LaTeX 원문을 화면용 글로 옮겼습니다(수식·표의 모양이 다를 수 있습니다). 내용은 고치지 않았습니다.

크리에이티브 커먼즈 저작자표시-동일조건변경허락.

문제 출처: 한국정보올림피아드(KOI) (CC BY-NC-SA 4.0) · International Olympiad in Informatics (IOI) (CC BY) · Centre for Education in Mathematics and Computing (CEMC), University of Waterloo (CC BY-NC 4.0) · Programmeringsolympiaden (CC BY-SA) · CSES Problem Set (Antti Laaksonen) (CC BY-NC-SA 4.0). 루미 알고리즘은 위 단체들과 관계없는 별도의 서비스이며, 자료는 원문 그대로 싣습니다. 문제마다 출처와 이용 조건을 따로 표기합니다.