programmers.co.kr/learn/courses/30/lessons/17678
코딩테스트 연습 - [1차] 셔틀버스
10 60 45 [23:59,23:59, 23:59, 23:59, 23:59, 23:59, 23:59, 23:59, 23:59, 23:59, 23:59, 23:59, 23:59, 23:59, 23:59, 23:59] 18:00
programmers.co.kr
def solution(n, t, m, timetable):
hh = "09"
mm = "00"
time = 0
con = [[0 for _ in range(m)]for _ in range(n)]
tabletime = []
timetable.sort()
if "24:00" in timetable:
index = timetable.index("24:00")
timetable[index] = "00:00"
for i in range(n):
for j in range(m):
if len(timetable) != 0:
time = hh + ":" + mm
if time >= timetable[0]:
con[i][j]= timetable[0]
tabletime.append(timetable.pop(0))
else:
break
mm = str(int(mm) + t)
if mm >= "60":
hh = str(int(hh) + 1)
mm = str(int(mm) - 60)
if mm == "0":
mm = mm + "0"
if len(hh) != 2:
hh = "0" + hh
if len(timetable) != 0:
if time < timetable[0]:
return time
if len(list(set(tabletime))) == 1:
if tabletime[0] < time:
hh = tabletime[0][0:2]
mm = tabletime[0][3:5]
if int(mm)- 1 < 0:
mm = "59"
hh = str(int(hh) - 1)
if len(hh) != 2:
hh = "0" + hh
else:
mm = str(int(mm) -1) + "0"
return hh+":"+mm
else:
return time
if con[n-1][m-1] == 0 :
return time
else:
for i in range(2,m+1):
if con[n-1][m-1] != con[n-1][m-i]:
return con[n-1][m-i]
return con
채점 결과
정확성: 45.8
합계: 45.8 / 100.0
어 뭐야...완전 똥이잖아?
다시풀기다시풀기다시풀기!!!
'2 > 프로그래머스' 카테고리의 다른 글
프로그래머스 연습 문제 - 소수 만들기 (0) | 2020.10.19 |
---|---|
프로그래머스 연습 문제 - 튜플 (0) | 2020.10.19 |
프로그래머스 연습 문제 - 멀쩡한 사각형 (0) | 2020.10.16 |
프로그래머스 연습 문제 - 피보나치 수 (0) | 2020.10.15 |
프로그래머스 연습 문제 - 뉴스 클러스터링 (0) | 2020.10.13 |