IT 세계의 후아
[python]시간/분/초 변환 본문
간단하게 생각하는 법 연습!
# 백준 2525
h, m = map(int, input().split())
t = int(input())
res = h * 60 + m + t
if res / 60 >= 24: print("%d %d" % (res / 60 - 24, res % 60))
else: print("%d %d" % (res / 60, res % 60))
# 수정 후
h, m = map(int, input().split())
hm = h*60 + m
hm += int(input())
if hm / 60 >= 24: hm -= 24*60
print(hm // 60, hm % 60)
'Coding > Python' 카테고리의 다른 글
[python]문자열 replace (0) | 2024.04.16 |
---|---|
[python]대소문자 함수-upper, lower, swapcase, isupper (0) | 2024.04.16 |
[python]bool 자료형/함수, 논리연산자 (0) | 2024.03.14 |
[python]sum (0) | 2024.03.14 |
[python]문자열 format, raw string (0) | 2024.03.14 |