[python] 백준 2525번 오답노트

김보현·2024년 5월 29일
0

PS

목록 보기
10/62

오답

now = input().split()
use = int(input())
h = int(now[0])
m = int(now[1])
m_plus = (m+use)%60
h_plus = (m+use)//60
if (h+h_plus)>=24 and m+m_plus>=60:
    print(0+(h_plus-1), m_plus)
else:
    print(h+h_plus, m_plus)

맞는줄 알았는데..ㅠㅠ

정답

now = input().split()
use = int(input())
h = int(now[0])
m = int(now[1])
h += (use)//60
m += (use)%60
if m >= 60:
    h += 1
    m -= 60
if h >= 24:
    h -= 24
print(h, m)    

틀린이유

use(걸리는시간)을 60으로 먼저 나눴으면 되는데 더한다음에 나눈다는 생각에 사로잡혀서 경우의 수가 많아졌고 그걸 다 생각하느라 if문을 나누기가 힘들었다.

profile
Fall in love with Computer Vision

0개의 댓글

관련 채용 정보