[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ๋ชจ์๊ณ ์ฌ / Python
๐ Problem Solving/Programmers
import sys
input = sys.stdin.readline
answers = list(map(int, input().split()))
def solution(answers):
first = [1, 2, 3, 4, 5]
second = [2, 1, 2, 3, 2, 4, 2, 5]
third = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5]
score = [0, 0, 0]
for i in range(len(answers)):
if answers[i] == first[i % 5]:
score[0] += 1
if answers[i] == second[i % 8]:
score[1] += 1
if answers[i] == third[i % 10]:
score[2] += 1
answer = []
temp = max(score)
for i in range(len(score)):
if temp == score[i]:
answer.append(i + 1)
return answer
print(solution(answers))
ํด์ค
๊ฐ ์ฌ๋ ๋ณ๋ก ๋ต์ ๋งํ ์๋ฅผ 1์ฉ ์ฆ๊ฐ์์ผ์คฌ๋ค.
๋ง์ง๋ง์ ๊ฐ์ฅ ๋์ ๊ฐ์ ์ธ๋ฑ์ค๋ค๋ง ์ถ์ถํด ๋ฆฌํดํด์คฌ๋ค.
'๐ Problem Solving > Programmers' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ๋ด์ / Python (0) | 2021.06.01 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ํฌ๋ ์ธ ์ธํ๋ฝ๊ธฐ / Python (0) | 2021.06.01 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] K๋ฒ์งธ์ / Python (0) | 2021.06.01 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ์์ฃผํ์ง ๋ชปํ ์ ์ / Python (0) | 2021.06.01 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ์ฒด์ก๋ณต / Python (0) | 2021.06.01 |