A801.Loan Repayment--Silver

提高+/省选-

USACO

通过率:0%

时间限制:1.00s

内存限制:128MB

题目描述

Farmer John owes Bessie NN gallons of milk (1N10121\le N\le 10^{12}). He has to
give her the milk within KK days. However, he doesn't want to give the milk
away too quickly. On the other hand, he has to make forward progress on the
loan, so he must give Bessie at least MM gallons of milk each day (1M10121\le M\le 10^{12}).
Here is how Farmer John decides to pay back Bessie. He first picks a positive
integer XX. He then repeats the following procedure every day:

  1. Assuming that Farmer John has already given Bessie GG gallons, compute NGX\frac{N-G}{X} rounded down. Call this number YY.
  2. If YY is less than MM, set YY to MM.
  3. Give Bessie YY gallons of milk.
    Determine the largest XX such that if Farmer John follows the above
    procedure, Farmer John gives Bessie at least NN gallons of milk after KK
    days (1K10121\le K\le 10^{12}).

输入格式

The only line of input contains three space-separated positive integers NN,
KK, and MM satisfying KM<NK\cdot M<N.

输出格式

Output the largest positive integer XX such that Farmer John will give Bessie
at least NN gallons using the above procedure.

输入输出样例

  • 输入#1

    10 3 3
    

    输出#1

    2
    

说明/提示

  • Test cases 2-4 satisfy K105.K\le 10^5.
  • Test cases 5-11 satisfy no additional constraints.
首页