1. 코드
import sys
import datetime as dt
minute = 0
for i in range(5):
ts_s, ts_e=map(str, sys.stdin.readline().split())
# ts_s = dt.datetime.strptime(ts[0], '%H:%M')
# ts_e = dt.datetime.strptime(ts[1], '%H:%M')
ts_s_h = int(ts_s[0:2])
ts_s_m = int(ts_s[3:5])
ts_e_h = int(ts_e[0:2])
ts_e_m = int(ts_e[3:5])
if ts_e_m>=ts_s_m:
minute += (ts_e_m-ts_s_m)+(ts_e_h-ts_s_h)*60
else:
minute += (ts_e_m+60-ts_s_m)+(ts_e_h-1-ts_s_h)*60
print(minute)
2. 생각
datetime을 이용해보고 싶었는데 흠
3. 플랫폼
Softeer
반응형
'Programming > Python' 카테고리의 다른 글
[Python3] 장애물 인식 프로그램 - Softeer(LEVEL2) (0) | 2023.08.04 |
---|---|
[Python3] 8단 변속기 - Softeer(LEVEL2) (0) | 2023.08.03 |
[Python3] 금고털이 - Softeer(LEVEL2) (2) | 2023.08.03 |
[Python3] 무인도 여행 - BFS / DFS (2) | 2023.07.27 |
[Python3] deque 양방향 큐 (1) | 2023.07.26 |