3 solutions

  • 1
    @ 2026-9-13 14:23:43
    #include<bits/stdc++.h>
    using namespace std;
        int n;
        int a[1005];
    int main(){
        cin>>n;
        for(int i=1;i<=n;i++)
        {
            int x;
            cin>>x;
            a[x]++;
        }
        int maxn  = 0;
        for(int i = 0;i<=1000;i++){
            if(a[i]>a[maxn])
            {
                maxn=i;
            }
        }
        cout<<maxn;
        return 0;
    }
    

    Information

    ID
    2870
    Time
    1000ms
    Memory
    64MiB
    Difficulty
    1
    Tags
    # Submissions
    89
    Accepted
    26
    Uploaded By