Skip to content

Commit a845dcb

Browse files
committed
91차 3번 문제풀이
1 parent 31d37f9 commit a845dcb

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

live9/test91/문제3/백한결.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
def solution(answers):
2+
drop_math1 = [1, 2, 3, 4, 5]
3+
drop_math2 = [2, 1, 2, 3, 2, 4, 2, 5]
4+
drop_math3 = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5]
5+
6+
result1, result2, result3 = 0, 0, 0
7+
8+
answer = []
9+
10+
for i in range(len(answers)):
11+
if drop_math1[i % len(drop_math1)] == answers[i]:
12+
result1 += 1
13+
if drop_math2[i % len(drop_math2)] == answers[i]:
14+
result2 += 1
15+
if drop_math3[i % len(drop_math3)] == answers[i]:
16+
result3 += 1
17+
18+
max_score = max(result1, result2, result3)
19+
20+
if result1 == max_score:
21+
answer.append(1)
22+
if result2 == max_score:
23+
answer.append(2)
24+
if result3 == max_score:
25+
answer.append(3)
26+
27+
return answer

0 commit comments

Comments
 (0)