CF911B.Two Cakes

普及/提高-

通过率:0%

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 aa pieces, and the second one — into bb pieces.

Ivan knows that there will be nn people at the celebration (including himself), so Ivan has set nn 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:

  1. Each piece of each cake is put on some plate;
  2. Each plate contains at least one piece of cake;
  3. 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 xx such that he can distribute the cakes according to the aforementioned conditions, and each plate will contain at least xx pieces of cake.

Help Ivan to calculate this number xx !

输入格式

The first line contains three integers nn , aa and bb ( 1<=a,b<=1001<=a,b<=100 , 2<=n<=a+b2<=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.

输出格式

Print the maximum possible number xx such that Ivan can distribute the cake in such a way that each plate will contain at least xx pieces of cake.

输入输出样例

  • 输入#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 11 cake on it.

In the second example you can have two plates with 33 and 44 pieces of the first cake and two plates both with 55 pieces of the second cake. Minimal number of pieces is 33 .

首页