문제 제목 : 모의고사
문제 출처 : 프로그래머스
알고리즘 : Brute Force
https://school.programmers.co.kr/learn/courses/30/lessons/42840
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
def solution(answers):
ans = []; le = len(answers); trr = [5,0,1,0,3,0,4]; score = [0]*3; thrr = [3,3,1,1,2,2,4,4,5,5]
for i in range(1,le+1):
one = 5 if i%5 == 0 else i%5
two = 2 if i%2>0 else trr[i%8]
three = thrr[ (i-1)%10 ]
if answers[i-1] == one: score[0]+=1
if answers[i-1] == two: score[1]+=1
if answers[i-1] == three: score[2]+=1
maxi = max(score)
for i,ival in enumerate(score):
if ival == maxi: ans.append(i+1)
if len(ans)>1:ans.sort()
return ans
'Problem Solving' 카테고리의 다른 글
[Math] 점프와 순간이동-프로그래머스 (0) | 2022.10.12 |
---|---|
[Queue] 다리를 지나는 트럭-프로그래머스 (0) | 2022.10.11 |
[Simulation] 교차로-소프티어(별3) (0) | 2022.09.04 |
[Brute Force] 카펫-프로그래머스(Lv.2) (0) | 2022.07.24 |
[Brute Force] 소수 찾기-프로그래머스(Lv.2) (0) | 2022.07.24 |