CF1003A.Polycarp's Pockets

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Polycarp has nn coins, the value of the ii-th coin is aia_i. 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.

波利卡普有 nn 枚硬币,第 ii 枚硬币的面值为 aia_i。波利卡普希望将所有硬币分配到他的口袋中,但不允许将面值相同的两枚硬币放入同一个口袋。

例如,若波利卡普有六枚硬币,表示为数组 a=[1,2,4,3,3,2]a = [1, 2, 4, 3, 3, 2],则他可以将硬币分配到两个口袋中,如下所示:[1,2,3],[2,3,4][1, 2, 3], [2, 3, 4]。

波利卡普希望用最少数量的口袋来完成全部硬币的分配。请帮助他实现这一目标。

输入格式

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

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

输入的第一行包含一个整数 nn(1≤n≤1001 \le n \le 100)—— 表示硬币的数量。

输入的第二行包含 nn 个整数 a1,a2,…,ana_1, a_2, \dots, a_n(1≤ai≤1001 \le a_i \le 100)—— 表示各硬币的面值。

输出格式

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.

仅输出一个整数——Polycarp 所需的最少口袋数量,使得所有硬币都能被分配,且任意两个面值相同的硬币不会被放入同一个口袋。

输入输出样例

  • 输入#1

    6
    1 2 4 3 3 2

    输出#1

    2
  • 输入#2

    1
    100

    输出#2

    1

输入解题思路,AI测评打分。不知道怎么写?

首页