본문 바로가기
Programmers

[python] 추석 트래픽

by DylanMsK 2019. 9. 3.

문제 출처

추석 트래픽

풀이


def solution(lines):
    logs = []
    for line in lines:
        _, done, time = line.split()
        h, m, s = done.split(':')
        end = (int(h)*60*60 + int(m)*60 + float(s))*1000
        logs.append((end-float(time[:-1])*1000+1, end))

    length = len(logs)
    max_ = 1
    for i in range(length-1):
        cnt = 1
        for j in range(i+1, length):
            if logs[j][1] - logs[i][1] >= 4000:
                break
            if logs[j][0] - logs[i][1] < 1000:
                cnt += 1
        max_ = max(max_, cnt)
    return max_

'Programmers' 카테고리의 다른 글

[python] 전화번호 목록  (0) 2019.09.03
[python] 완주하지 못한 선수  (0) 2019.09.03
[python] 무지의 먹방 라이브  (0) 2019.09.03
[python] 단어 변환  (0) 2019.09.01
[python] 네트워크  (0) 2019.09.01