레벨2 문제 실패
def change(sen):
while ('#' in sen):
sen = sen.replace('C#', 'c')
sen = sen.replace('D#', 'd')
sen = sen.replace('F#', 'f')
sen = sen.replace('G#', 'g')
sen = sen.replace('A#', 'a')
sen = sen.replace('E#', 'e') # 추가해봄
return sen
def solution(m, info):
m = change(m)
music = []
for i in range(len(info)):
arr = info[i].split(',')
start, end, name = arr[0], arr[1], arr[2]
melo = change(arr[3])
h1, m1 = map(int, start.split(':'))
h2, m2 = map(int, end.split(':'))
one = h1 * 60 + m1
two = h2 * 60 + m2
time = two - one
if ( len(melo) < time ):
gob = time // len(melo) + 1
melo = melo * gob
melo = melo[:time]
else:
melo = melo[:time]
music.append([melo, time, name, i])
answer = []
for i in range(len(music)):
if ( m in music[i][0] ):
answer.append([music[i][1], music[i][3], music[i][2]])
if len(answer) == 0:
return "(None)"
answer.sort(key = lambda x:(-x[0], x[1]))
return answer[0][2]
이것도 몇시간동안 끙끙댔지만 결국엔 풀긴 풀었다... # 바꾸는 아이디어만 알았으면 혼자 풀었을듯