본문 바로가기

Coding Test

백준 2884번, 2525번 - if문

2884번(알람시계)

답안

H, M = map(int, input().split())
if M > 44:
    print(H, M-45)
elif M < 45 and H > 0:
    print(H-1, M+15)
else:
    print(23, M+15)

2525번(오븐시계)

답안

A, B = map(int, input().split())
C = int(input())
A += C//60
B += C % 60
if B >= 60:
    A += 1
    B -= 60
if A >= 24:
    A -= 24

print(A, B)

 

'Coding Test' 카테고리의 다른 글

백준 4673번 - set  (0) 2022.03.04
백준 4344번 - 리스트, %.nf  (0) 2022.03.03
백준 1110번 - while문  (0) 2022.02.19
백준 10951번 - while문 탈출  (0) 2022.02.18
백준 8393, 2741, 2742 - for문  (0) 2022.02.17