CF1032A.Kitchen Utensils
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The king's birthday dinner was attended by k guests. The dinner was quite a success: every person has eaten several dishes (though the number of dishes was the same for every person) and every dish was served alongside with a new set of kitchen utensils.
All types of utensils in the kingdom are numbered from 1 to 100. It is known that every set of utensils is the same and consist of different types of utensils, although every particular type may appear in the set at most once. For example, a valid set of utensils can be composed of one fork, one spoon and one knife.
After the dinner was over and the guests were dismissed, the king wondered what minimum possible number of utensils could be stolen. Unfortunately, the king has forgotten how many dishes have been served for every guest but he knows the list of all the utensils left after the dinner. Your task is to find the minimum possible number of stolen utensils.
国王的生日晚宴共有 k 位宾客出席。晚宴非常成功:每位宾客都吃了若干道菜(且每位宾客所吃的菜数相同),而每道菜均配有一套全新的厨房用具。
王国中所有类型的用具编号为 1 至 100。已知每套用具完全相同,且均由不同种类的用具组成;但每种具体类型的用具在一套中至多出现一次。例如,一套有效的用具可由一把叉子、一把勺子和一把刀组成。
晚宴结束后宾客离席,国王开始思索:可能被窃取的用具的最小数量是多少?不幸的是,国王已忘记每位宾客吃了多少道菜,但他知道晚宴后剩余的所有用具清单。你的任务是求出可能被窃取的用具的最小数量。
输入格式
The first line contains two integer numbers n and k (1≤n≤100,1≤k≤100) — the number of kitchen utensils remaining after the dinner and the number of guests correspondingly.
The next line contains n integers a1,a2,…,an (1≤ai≤100) — the types of the utensils remaining. Equal values stand for identical utensils while different values stand for different utensils.
第一行包含两个整数 n 和 k(1≤n≤100,1≤k≤100)—— 分别表示晚餐后剩余的厨具数量以及宾客人数。
第二行包含 n 个整数 a1,a2,…,an(1≤ai≤100)—— 表示剩余厨具的类型。相等的值代表相同的厨具,不同的值代表不同的厨具。
输出格式
Output a single value — the minimum number of utensils that could be stolen by the guests.
输出一个数值——客人可能偷走的餐具的最少数量。
输入输出样例
输入#1
5 2 1 2 2 1 3
输出#1
1
输入#2
10 3 1 3 3 1 3 5 5 5 5 100
输出#2
14
说明/提示
In the first example it is clear that at least one utensil of type 3 has been stolen, since there are two guests and only one such utensil. But it is also possible that every person received only one dish and there were only six utensils in total, when every person got a set (1,2,3) of utensils. Therefore, the answer is 1.
One can show that in the second example at least 2 dishes should have been served for every guest, so the number of utensils should be at least 24: every set contains 4 utensils and every one of the 3 guests gets two such sets. Therefore, at least 14 objects have been stolen. Please note that utensils of some types (for example, of types 2 and 4 in this example) may be not present in the set served for dishes.
在第一个例子中,显然至少有一个类型为 3 的餐具被偷走了,因为共有两名客人,但该类型的餐具只有一个。但也有可能每位客人都只获得一道菜,且总共仅有六个餐具,即每位客人都恰好获得一套 (1,2,3) 的餐具。因此,答案为 1。
可以证明,在第二个例子中,每位客人至少应被提供两道菜,因此餐具总数至少应为 24:每套餐具包含 4 个,而 3 位客人每人获得两套。因此,至少有 14 件物品被偷走。请注意,某些类型的餐具(例如本例中的类型 2 和 4)可能并未出现在为菜品所配的餐具集合中。
输入解题思路,AI测评打分。不知道怎么写?