본문 바로가기

알고리즘 문제풀이

백준 2884 알람시계 브3 Python

리스트로 풀기

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)

'알고리즘 문제풀이' 카테고리의 다른 글

swea 4836. 색칠하기 Python  (0) 2024.01.31
[백준]1546 평균 파이썬 Python  (0) 2024.01.29
백준 14215 세막대기 Python  (1) 2024.01.26
백준 2754 브론즈5 Python  (0) 2024.01.26
백준 5532 방학숙제 Python  (0) 2024.01.24