2024년 01월 08일
https://www.acmicpc.net/problem/1408
1408번: 24
도현이는 Counter Terror Unit (CTU)에서 일하는 특수요원이다. 도현이는 모든 사건을 정확하게 24시간이 되는 순간 해결하는 것으로 유명하다. 도현이는 1시간 만에 범인을 잡을 수 있어도 잡지 않는
www.acmicpc.net
내 풀이
31120kb 40ms
h1, m1, s1 = map(int,input().split(":"))
h2, m2, s2 = map(int,input().split(":"))
time = h2*3600+m2*60+s2 - (h1*3600+m1*60+s1)
if time < 0:
time += 24*60*60
h3 = time//3600
m3 = (time%3600)//60
s3 = (time%3600)%60
if h3 < 10:
h3 = '0' + str(h3)
else:
str(h3)
if m3 < 10:
m3 = '0' + str(m3)
else:
str(m3)
if s3 < 10:
s3 = '0' + str(s3)
else:
str(s3)
print(f"{h3}:{m3}:{s3}")
'파이썬 알고리즘 연습' 카테고리의 다른 글
[백준 1440번] 타임머신 (0) | 2024.01.17 |
---|---|
[백준 1434번] 책 정리 (0) | 2024.01.17 |
[백준 1392번] 노래 악보 (0) | 2024.01.17 |
[백준 1371번] 가장 많은 글자 (0) | 2024.01.16 |
[백준 1362번] 펫 (0) | 2024.01.16 |