十五月明


私信TA

用户名:dotcpp0605328

访问量:2907

签 名:

等  级
排  名 500
经  验 4467
参赛次数 0
文章发表 68
年  龄 18
在职情况 学生
学  校 曲阜师范大学
专  业 人工智能

  自我简介:

Easy

解题思路:

注意事项:

参考代码:

#include<iostream>

#include<algorithm>

using namespace std;

int main()

{

    int n;cin>>n;

    int a[n];

    int max=1;

    int res;

    for(int i=0;i<n;i++) cin>>a[i];

    sort(a,a+n);

    int count=1;

    for(int i=0;i<n-1;i++)

    {

        

        if(a[i]==a[i+1])

        {

            count++;

            if(count>max) {max=count; res=a[i];}

        }

        else count=1; 

    }

    cout<<res<<endl;

    cout<<max<<endl;

}


 

0.0分

1 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区