Coding Test

백준 2884번, 2525번 - if문

surge_95 2022. 2. 23. 22:52

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)