题目描述

Polycarp has n n n coins, the value of the i i i -th coin is ai a_i ai​ . 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] 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] [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.

输入输出格式

输入格式:

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

The second line of the input contains n n n integers a1,a2,…,an a_1, a_2, \dots, a_n a1​,a2​,…,an​ ( 1≤ai≤100 1 \le a_i \le 100 1≤ai​≤100 ) — values of coins.

输出格式:

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.

输入输出样例

输入样例#1: 复制

6
1 2 4 3 3 2

输出样例#1: 复制

2

输入样例#2: 复制

1
100

题意:找出相同的数输出

思路:看代码

#include<bits/stdc++.h>
using namespace std;
int a[108],temp,maxn,n;
int main()
{scanf("%d",&n);for(int i=0;i<n;i++){scanf("%d",&temp);a[temp]++;maxn=max(maxn,a[temp]);}printf("%d\n",maxn);return 0;
}

落谷CF1003A Polycarp's Pockets相关推荐

  1. 落谷P1008三连击(C++)

    落谷P1008 先贴我的代码: #include<iostream>#include<sstream>using namespace std;int main(){int a[ ...

  2. 落谷P1189 `SEARCH`

    落谷P1189 `SEARCH` `SEARCH` - 洛谷https://www.luogu.com.cn/problem/P1189本题使用递归算法,核心代码中for里面两个if判断进入下一层递归 ...

  3. 【Java实现】P1249最大乘积 -落谷

    只要会思路得到小一点数字的相应结果是并不难的. 但是这道题的难点就在于乘积会非常的大,如果用int型得到的结果是0,其他的也会超范围得到乱码.所以就必须使用到高精度. 这里首先解决一下思路问题,我参考 ...

  4. CodeForces - 1003A Polycarp's Pockets

    题目链接: A. Polycarp's Pockets time limit per test 1 second memory limit per test 256 megabytes input s ...

  5. Codeforces #494 A. Polycarp's Pockets

    A. Polycarp's Pockets 废话不多说,直接上AC程序! #include<bits/stdc++.h> using namespace std; int n,x; int ...

  6. codeforces 1003A. Polycarp's Pockets,C. Intense Heat(暴力)

    A. Polycarp's Pockets 题目链接:codeforces 1003A 题意:      给n个数,要求相同的数不能放在一个口袋,问最少需要多少个口袋 题解:     求出最多的相同数 ...

  7. 落谷 P1060 开心的金明

    一个简单的动态规划. 把钱数看做背包容量. #include<stdio.h> int max(int a,int b) {if(a>b) return a;return b; } ...

  8. 落谷 P3375 【模板】KMP字符串匹配

    题目描述 如题,给出两个字符串s1和s2,其中s2为s1的子串,求出s2在s1中所有出现的位置. 为了减少骗分的情况,接下来还要输出子串的前缀数组next. 输入格式: 第一行为一个字符串,即为s1 ...

  9. 落谷P3712少女与战车(疑似CSDN首发)

    直接上代码(提前声明:时T时A,几次AC看人品) 不喜勿喷. //#pragma GCC optimize(2) //#pragma GCC optimize("Ofast") # ...

最新文章

  1. redis入门(03)redis的配置
  2. CVPR2019|微软、中科大开源基于深度高分辨表示学习的姿态估计算法
  3. 什么是neo4j cql查询语言 cypher 密码 暗号
  4. 机器学习(四) 下采样和上采样
  5. SAP UI5和CRM WebUI的View和Controller是如何绑定的
  6. codeforces 261 D
  7. bootstrap validator 提供了哪些验证函数
  8. spring AOP实现——xml方法
  9. HDU 4873 ZCC Loves Intersection(可能性)
  10. 如何维持手机电池寿命_手机电池不耐用,都怪这些充电坏毛病
  11. 比尔盖茨夫妇宣布离婚 结束27年婚姻
  12. spring源码bean的加载过程
  13. 10分钟了解JSON Web令牌(JWT) 虫虫搜奇
  14. 位操作实现加减乘除四则运算
  15. 计算机存储器的容量单位有哪些,存储器容量单位有哪些,它们之间的关系是什么?...
  16. 软件需求跟踪矩阵例子
  17. 阿里达摩院发布2019十大科技趋势:数字身份将成为第二张身份证
  18. 软件测试--因果图分析方法
  19. java浪漫之心代码_浪漫桃心的Android表白程序
  20. Android安装包APK如何解压

热门文章

  1. VSCode中tab自动补全标签
  2. Hive 快速上手--官网中文翻译
  3. IDEA使用技巧大全
  4. 模糊推理-图像边缘检测算法(min-max重心法)
  5. 混沌数学之logistic模型
  6. linux 网桥迁移命令,Linux 网桥配置命令: brctl
  7. 生理期健康系列(一)
  8. c语言求3个整数的平均数程序,c语言求余(c语言求任意三个数的平均值)
  9. 哈希树(HashTree)
  10. win10 家庭版 共享文件