Bomb Kirby Running
Cat Life - GT-K
1204번 최빈수 구하기

2023. 4. 16. 21:31SWEA

Problem Solving - Level 2 - 최빈수 구하기

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=2&contestProbId=AV13zo1KAAACFAYh&categoryId=AV13zo1KAAACFAYh&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=ALL&select-1=2&pageSize=10&pageIndex=3 

#include <iostream>
using namespace std;
int main()
{
    int T,score,num;
    cin>>T;
    
    while(T--)
    {
        cin>>num;
        int result[101]={0,};
        for(int i=0;i<1000;i++)
        {
            cin>>score;
            result[score]++;
        }
        
        int max=0;
        for(int i=1;i<101;i++)
        {
            if(result[max]<=result[i])
            {
                max=i;
            }
        }
        cout<<"#"<<num<<" "<<max<<endl;
    }
    return 0;
}

'SWEA' 카테고리의 다른 글

1285번 아름이의 돌 던지기  (0) 2023.04.16
1284번 수도 요금 경쟁  (0) 2023.04.16
2072번 홀수만 더하기  (0) 2023.03.23
2071번 평균값 구하기  (0) 2023.03.23
2070번 큰 놈, 작은 놈, 같은 놈  (0) 2023.03.20