알고리즘 문제풀이

백준 2884 알람시계 브3 Python

아크몽 2024. 1. 26. 17:44

리스트로 풀기

score = list(map(int,input().split()))
if score[1] < 45:
    score[0] = score[0] -1
    score[1] = 60 + (score[1] - 45)
else:
    score[0] = score[0] - 45

print(score[0],score[1])

정수로 풀기

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

print(h,m)