Polycarp has nn coins, the value of the ii-th coin is aiai. Polycarp wants to distribute all the coins between his pockets, but he cannot put two coins with the same value into the same pocket.

For example, if Polycarp has got six coins represented as an array a=[1,2,4,3,3,2]a=[1,2,4,3,3,2], he can distribute the coins into two pockets as follows: [1,2,3],[2,3,4][1,2,3],[2,3,4].

Polycarp wants to distribute all the coins with the minimum number of used pockets. Help him to do that.

Input

The first line of the input contains one integer nn (1≤n≤1001≤n≤100) — the number of coins.

The second line of the input contains nn integers a1,a2,…,ana1,a2,…,an (1≤ai≤1001≤ai≤100) — values of coins.

Output

Print only one integer — the minimum number of pockets Polycarp needs to distribute all the coins so no two coins with the same value are put into the same pocket.

Examples

Input

6
1 2 4 3 3 2

Output

2

Input

1
100

Output

1

题解:找出现重复次数最多的元素的数量即可

AC代码1:

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring> using namespace std; int main() { int n;
cin>>n;
int a[105];
for(int t=0; t<n; t++) {
scanf("%d",&a[t]);
}
sort(a,a+n);
int maxn=1;
int sum=1;
for(int t=0; t<n-1; t++) {
if(a[t]==a[t+1]) {
sum++;
} else if(a[t]!=a[t+1]) {
sum=1;
}
if(maxn<sum) {
maxn=sum;
}
}
cout<<maxn<<endl;
return 0;
}

AC代码2:

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm> using namespace std; int main()
{ int sum[101]={0};
int n;
cin>>n;
int k;
for(int t=0;t<n;t++)
{
scanf("%d",&k);
sum[k]++;
}
int maxn=1;
for(int t=1;t<=100;t++)
{
if(sum[t]>maxn)
{
maxn=sum[t];
}
}
cout<<maxn<<endl;
return 0;
}

Polycarp's Pockets(思维)的更多相关文章

  1. 7.24-Codeforces Round #494 (Div. 3)

    链接:http://codeforces.com/contest/1003 A. Polycarp's Pockets 题型:模拟 题意:把初始集合拆分,要求相同的数不在同一个集合中,求出需要的集合个 ...

  2. Codeforces Round #494 (Div 3) (A~E)

    目录 Codeforces 1003 A.Polycarp's Pockets B.Binary String Constructing C.Intense Heat D.Coins and Quer ...

  3. CF1005D Polycarp and Div 3 思维

    Polycarp and Div 3 time limit per test 3 seconds memory limit per test 256 megabytes input standard ...

  4. CodeForces 1005D Polycarp and Div 3(思维、贪心、dp)

    http://codeforces.com/problemset/problem/1005/D  题意: 给一个仅包含数字的字符串,将字符串分割成多个片段(无前导0),求这些片段里最多有多少是3的倍数 ...

  5. cf-789A (思维)

    A. Anastasia and pebbles time limit per test 1 second memory limit per test 256 megabytes input stan ...

  6. 『ACM C++』 Codeforces | 1005D - Polycarp and Div 3

    今天佛了,魔鬼周一,在线教学,有点小累,但还好,今天AC了一道,每日一道,还好达成目标,还以为今天完不成了,最近任务越来越多,如何高效完成该好好思考一下了~最重要的还是学业的复习和预习. 今日兴趣新闻 ...

  7. [C#][算法] 用菜鸟的思维学习算法 -- 马桶排序、冒泡排序和快速排序

    用菜鸟的思维学习算法 -- 马桶排序.冒泡排序和快速排序 [博主]反骨仔 [来源]http://www.cnblogs.com/liqingwen/p/4994261.html  目录 马桶排序(令人 ...

  8. Photoshop、Illustrator思维导图笔记

    半年前学习Photoshop时记得的思维导图笔记,可能不是很全,常用的基本都记下了.

  9. CYQ.Data 从入门到放弃ORM系列:开篇:自动化框架编程思维

    前言: 随着CYQ.Data 开始回归免费使用之后,发现用户的情绪越来越激动,为了保持这持续的激动性,让我有了开源的念头. 同时,由于框架经过这5-6年来的不断演进,以前发的早期教程已经太落后了,包括 ...

随机推荐

  1. JAVA JDBC 读取配置文件链接数据库(oracle)

    ----db.properties-------- dbDriver = oracle.jdbc.driver.OracleDriverurl = jdbc:oracle:thin:@192.168. ...

  2. Parallel Programming-Concurrent Collections

    备忘:asp.net平台下线程安全集合类.   Class Description BlockingCollection<T> Provides blocking and bounding ...

  3. 找工作——JVM内存管理

    1. JVM类加载机制 类从被加载到虚拟机内存开始,到卸载出内存为止,它的整个生命周期包括:加载.连接(验证.准备.解析).初始化.使用和卸载阶段. 加载:根据查找路径找到对应的class文件,然后倒 ...

  4. IPC的使用

    IPC,Inter-Processor Communication是SYS/BIOS处理核间通信的组件: IPC的几种应用方式: 1.最小使用(Minimal use) 这种情况是通过核间的通知机制( ...

  5. C++模板特化编程

    在C++中,模板特化是除了类之外的一种封装变化的方法.模板特化可以通过编译器来对不同的模板参数生成不同的代码. 模板特化通常以模板结构体作为载体.常用技法包括:类型定义.静态成员常量定义和静态成员函数 ...

  6. stm32之外设控制

    本文将提到以下内容: 蜂鸣器 按键控制 电容触摸 温度传感器 红外 TFTLCD触摸屏 MPU6050传感器 SPI-FLASH SDIO_SD卡 ucos-III移植 一.蜂鸣器 蜂鸣器是一种一体化 ...

  7. springMVC绑定json参数之二(2.2.1)

    二.springmvc 接收不同格式的json字符串 2.扫盲完了继续测试springmvc 接收不同格式的json字符串 1).格式一:json简单数组对象 前台两种传递方式: 方式一(需要拼接js ...

  8. PWA PSI statusingclient.UpdateStatus更新任务页面的AssnCustomFields的TextValue值

    1.注意Changesxml格式和下面一定要一样 2.CustomFieldGuid和CustomFieldName都不能少,自定义域的uid和name其中uid或者是MD_PROP_UID_SECO ...

  9. 安装Ruby On Rails时运行“gem install rails”没有反应怎么办?

    这两天在我的mac机上安装Ruby On Rails,感觉很爽,似乎在使用一个Windows和Linux的结合体,要界面有界面,要命令行有命令行. 不过安装Ruby On Rails的过程中遇到一个问 ...

  10. xdu2017校赛F

    Problem F Dogs of Qwordance Senior Backend R&D Engineers 问题描述 那年夏天,锘爷和杰师傅漫步在知春公园的小道上.他们的妻子.孩子牵 着 ...