2018 KAKAO BLIND RECRUITMENT
- 문자열 치환 아이디어 참고
def change(song):
song=song.replace('A#','a').replace('C#', 'c').replace('D#', 'd').replace('F#', 'f').replace('G#', 'g')
return song
def solution(m, musicinfos):
answer = ''
m=change(m)
max_diff=0
for info in musicinfos:
start,end,title,song=info.split(',')
song=change(song)
ends=list(map(int,end.split(':')))
starts=list(map(int,start.split(':')))
diff=(ends[0]*60+ends[1])-(starts[0]*60+starts[1])
multi=diff//len(song)+1
new_song=(song*multi)[:diff]
if m in new_song:
if diff>max_diff:
answer=title
max_diff=diff
if answer=='':
return "(None)"
return answer
'IT > coding study' 카테고리의 다른 글
[programmers] [3차] n진수 게임 (python) (0) | 2022.01.24 |
---|---|
[programmers] [3차] 압축 (python) (0) | 2022.01.18 |
[programmers] 크레인 인형뽑기 게임 (python) (0) | 2022.01.10 |
[acmicpc] 8911. 거북이(python) (0) | 2021.12.27 |
[acmicpc] 2252. 줄 세우기(python) (0) | 2021.12.01 |