CF911B.Two Cakes
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
It's New Year's Eve soon, so Ivan decided it's high time he started setting the table. Ivan has bought two cakes and cut them into pieces: the first cake has been cut into a pieces, and the second one — into b pieces.
Ivan knows that there will be n people at the celebration (including himself), so Ivan has set n plates for the cakes. Now he is thinking about how to distribute the cakes between the plates. Ivan wants to do it in such a way that all following conditions are met:
- Each piece of each cake is put on some plate;
- Each plate contains at least one piece of cake;
- No plate contains pieces of both cakes.
To make his guests happy, Ivan wants to distribute the cakes in such a way that the minimum number of pieces on the plate is maximized. Formally, Ivan wants to know the maximum possible number x such that he can distribute the cakes according to the aforementioned conditions, and each plate will contain at least x pieces of cake.
Help Ivan to calculate this number x!
很快就要到除夕夜了,因此伊万决定是时候开始摆餐桌了。伊万买了两块蛋糕,并将它们切成了若干块:第一块蛋糕被切成了 a 块,第二块蛋糕被切成了 b 块。
伊万知道庆祝活动上将有 n 位客人(包括他自己),因此他准备了 n 个盘子来盛放蛋糕。现在他正在思考如何将蛋糕分装到这些盘子中。伊万希望以满足以下所有条件的方式进行分配:
- 每块蛋糕的每一块都必须放在某个盘子中;
- 每个盘子中至少包含一块蛋糕;
- 任一盘子中不能同时包含两块蛋糕的碎片。
为了让客人们开心,伊万希望以一种方式分配蛋糕,使得每个盘子中蛋糕块数的最小值尽可能大。形式化地说,伊万希望找出最大的可能数 x,使得他能按上述条件分配蛋糕,且每个盘子中至少含有 x 块蛋糕。
请帮助伊万计算这个数 x!
输入格式
The first line contains three integers n, a and b (1 ≤ a, b ≤ 100, 2 ≤ n ≤ a + b) — the number of plates, the number of pieces of the first cake, and the number of pieces of the second cake, respectively.
第一行包含三个整数 n、a 和 b(1 ≤ a, b ≤ 100,2 ≤ n ≤ a + b),分别表示盘子的数量、第一块蛋糕的块数以及第二块蛋糕的块数。
输出格式
Print the maximum possible number x such that Ivan can distribute the cake in such a way that each plate will contain at least x pieces of cake.
输出最大的可能数 x,使得伊万能够以每盘至少包含 x 块蛋糕的方式分配蛋糕。
输入输出样例
输入#1
5 2 3
输出#1
1
输入#2
4 7 10
输出#2
3
说明/提示
In the first example there is only one way to distribute cakes to plates, all of them will have 1 cake on it.
In the second example you can have two plates with 3 and 4 pieces of the first cake and two plates both with 5 pieces of the second cake. Minimal number of pieces is 3.
在第一个例子中,将蛋糕分配到盘子上的方法只有一种,每个盘子上都将恰好有 1 块蛋糕。
在第二个例子中,你可以将第一块蛋糕切成两份,分别放在两个盘子上,大小分别为 3 块和 4 块;并将第二块蛋糕也切成两份,分别放在两个盘子上,每份均为 5 块。此时最小的块数为 3。
输入解题思路,AI测评打分。不知道怎么写?