🚩 Coding Test/SWEA
[SWEA][S/W 문제해결 기본][Python] 1204 최빈수 구하기
zo0oz
2024. 5. 13. 22:45
728x90
[문제]
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
[코드]
T = int(input())
for t in range(1,T+1):
tc = int(input())
score = list(map(int,input().split()))
cnt = [0] * 101
for s in score:
cnt[s] += 1
#최빈수가 여러 개일 경우, 가장 큰 점수 출력
res,idx = cnt[1], 1
for i in range(2,101):
if cnt[i] >= res:
res = cnt[i]
idx = i
print("#"+str(t),idx)
반응형