Cometin'

BOJ-2884 - Python

2020-06-22 at Algorithm category

24시간 기준으로 45분을 뺀 시각을 출력하는 문제, 입력받은 분에 45를 뺀 값으로 비교를 했으며 0시 일 때를 따로 확인하여 23시로 바꿔주었다.

h, m = list(map(int, input().split()))
m -= 45
if m < 0:
    if h == 0:
        print(23, 60 + m)
    else:
        print(h-1, 60 + m)
else:
    print(h, m)

hyesungoh

Personal blog by hyesungoh.

I like to share my knowledge for those who wandering in issue.