## 문제
BOJ 2525 오븐 시계
## 풀이
첫줄에 시간과 분이 주어진다.
이 시간에 더해야될 분은 0~59 사이 정수,
분끼리 일단 더한 뒤에.
분이 60이상 일경우 시간에 1 더하고 분에서 60 뺀다.
시간이 24이상 일경우 24를 뺀다.
## 코드
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tmp_time = input().split() | |
tmp_time2 = input() | |
H = int(tmp_time[0]) | |
M = int(tmp_time[1]) | |
M2 = int(tmp_time2) | |
M = M + M2 | |
while(M >= 60): | |
H += 1 | |
M -= 60 | |
if H >= 24: | |
H -= 24 | |
print(str(H) + ' ' + str(M)) |
분끼리 더하는 경우 120이 될수 있기때문에 반복문으로 분이 60보다 작게 되도록 만들자.
0 댓글