https://www.acmicpc.net/problem/3029
문제 스토리가 다소.. 그렇다만 결국은 걸리는 시간을 구하는 문제
이런 문제는 많이 볼 수 있으니까 코드 짜는 거 어렵지 않을 거임
문제의 조건에 유의하면서 하나씩 코드를 짜보자
본인 제출 코드
a,b,c=map(int, input().split(':')) d,e,f=map(int, input().split(':')) g=d-a h=e-b i=f-c if i<0: i+=60 h-=1 if h<0: h+=60 g-=1 if g<0: g+=24 if g==0 and h==0 and i==0: g+=24 print(str(g).zfill(2),':',str(h).zfill(2),':',str(i).zfill(2),sep='') |