Notice
Recent Posts
Recent Comments
ยซ   2024/11   ยป
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Tags more
Archives
Today
Total
๊ด€๋ฆฌ ๋ฉ”๋‰ด

๐ŸŒฒ์ž๋ผ๋‚˜๋Š”์ฒญ๋…„

[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค] ๋ชจ์˜๊ณ ์‚ฌ, python ๋ณธ๋ฌธ

์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋ฌธ์ œํ’€์ด

[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค] ๋ชจ์˜๊ณ ์‚ฌ, python

JihyunLee 2021. 1. 31. 13:01
๋ฐ˜์‘ํ˜•

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
def solution(answers):
    score =  [0,0,0]
    s1 = list("12345")
    s2 = list("21232425")
    s3 = list("3311224455")
    
    for i,answer in enumerate(answers):
        if s1[i%len(s1)] == str(answer):
            score[0+=1
        if s2[i%len(s2)] == str(answer):
            score[1+=1
        if s3[i%len(s3)] == str(answer):
            score[2+=1
    
    max_score = max(score)
    answer = []
    for i, s in enumerate(score):
        if s == max_score:
            answer.append(i+1)
        
    return answer
cs

ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ๋ชจ์˜๊ณ ์‚ฌ ๋ฌธ์ œ๋ฅผ ํ’€์–ด ๋ณด์•˜๋‹ค.

๋ฐ˜์‘ํ˜•