文章

5

粉丝

492

获赞

1

访问

34.7k

头像
C++ 用了map容器
P1057
发布于2021年3月10日 01:35
阅读数 6.8k

#include <stdio.h>
#include <limits.h>
#include <map>
using namespace std;


int main()
{
    int N, i, temp, count = 0, num = INT_MAX ,cnt;
    scanf("%d", &N);
    map<int,int> m;
    for ( i = 0; i < N; i++)
    {
    
        scanf("%d", &temp);
        cnt = m[temp] ++;
        if (cnt > count)
        {
            
            count = m[temp];
            num = temp;

        }
        else if ( cnt == count)
        {
          ...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发