SWEA 1204

녹색자몽·2021년 8월 4일
0

Algorithm

목록 보기
21/80
post-thumbnail

2중 for문과 if문을 통한 최빈수 구하기

T = int(input())

for i in range(T):
    
    n = int(input())
    
    scores = list(map(int, input().split()))

    max = 0
    
    for score in range(101):

        if scores.count(score) == 0:
            continue    

        elif scores.count(score) > scores.count(max):
            max = score

        elif scores.count(score) == scores.count(max):
            if score>max:
                max = score
    
    print(f"#{n} {max}")
profile
볕 좋은 날 시작하는 개발일기

0개의 댓글

관련 채용 정보