문제 출처
풀이
def solution(answers):
a = [1, 2, 3, 4, 5]
b = [2, 1, 2, 3, 2, 4, 2, 5]
c = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5]
score = [0, 0, 0]
for idx, correct in enumerate(answers):
if correct == a[idx%5]:
score[0] += 1
if correct == b[idx%8]:
score[1] += 1
if correct == c[idx%10]:
score[2] += 1
answer = sorted([idx+1 for idx, s in enumerate(score) if s == max(score)])
return answer
'Programmers' 카테고리의 다른 글
[python] 카펫 (0) | 2019.08.30 |
---|---|
[python] 소수 찾기 (0) | 2019.08.28 |
[python] 주식가격 (0) | 2019.08.25 |
[python] 기능개발 (0) | 2019.08.25 |
[python] 다리를 지나는 트럭 (0) | 2019.08.25 |