1 solutions

  • -1
    @ 2025-7-12 19:58:18
    using namespace std;
    int main()
    {
        int n;
        int a[100000];
        cin >> n;
        for(int i = 0;i < n;i++)
        {
            cin >> a[i];
        }
        sort(a,a+n);
        int cnt = 1;
        int sum = 1;
        int max = 0;
        for(int i = 1;i < n;i++)
        {
            if(a[i] == a[i-1])
            {
                sum++;
            }
            else
            {
                cnt++;
                if(sum >= max)
                {
                    max = sum;
                }
                sum = 1;
            }
        }
        cout<<max<<" "<<cnt;
        return 0;
    }
    
    ```
    `
    这道题还算比较简单,自行观看吧
  • 1

Information

ID
97
Time
1000ms
Memory
256MiB
Difficulty
6
Tags
(None)
# Submissions
73
Accepted
21
Uploaded By