-
[python]백준 가희와 열리지 않는 건널목 27885번알고리즘 문제풀이/백준(파이썬) 2023. 5. 2. 23:30
코드
import sys sys.stdin = open("27885.txt", "r") c,h=map(int,input().split()) z=[] for _ in range(c+h): q,w,e=map(int,input().split(":")) z.append(q*60*60+w*60+e) z.sort()#먼저 접근한 순서 x=-40#통과 시간 s=0#총 통과시간(내려간 시간) for i in z: #시간이 겹치는 확인 if i-x>=40:#40이상 이면 p=40 else:#40보다 작다면 p=i-x s+=p x=i print(86400-s) #24시간 초로 변산 86400
링크
https://www.acmicpc.net/problem/27885
'알고리즘 문제풀이 > 백준(파이썬)' 카테고리의 다른 글
[python]백준 2007년 1924번 (0) 2023.05.04 [python]백준 카트라이더: 드리프트 27522번 (0) 2023.05.03 [python]백준 화성 수학 5355번 (0) 2023.05.01 [python]백준 진짜 공간 1350번 (0) 2023.04.30 [python]백준 파티가 끝나고 난 뒤 2845번 (0) 2023.04.29