Logo
(追記) (追記ここまで)

18320번 - Loan Repayment 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB80221818328.638%

문제

Farmer John owes Bessie $N$ gallons of milk (1ドル\le N\le 10^{12}$). He has to give her the milk within $K$ 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 $M$ gallons of milk each day (1ドル\le M\le 10^{12}$).

Here is how Farmer John decides to pay back Bessie. He first picks a positive integer $X$. He then repeats the following procedure every day:

  1. Assuming that Farmer John has already given Bessie $G$ gallons, compute $\frac{N-G}{X}$ rounded down. Call this number $Y$.
  2. If $Y$ is less than $M,ドル set $Y$ to $M$.
  3. Give Bessie $Y$ gallons of milk.

Determine the largest $X$ such that if Farmer John follows the above procedure, Farmer John gives Bessie at least $N$ gallons of milk after $K$ days (1ドル\le K\le 10^{12}$).

입력

The only line of input contains three space-separated positive integers $N,ドル $K,ドル and $M$ satisfying $K\cdot M<N$.

출력

Output the largest positive integer $X$ such that Farmer John will give Bessie at least $N$ gallons using the above procedure.

제한

예제 입력 1

10 3 3

예제 출력 1

2

힌트

For the first test case, when $X=2$ Farmer John gives Bessie 5ドル$ gallons on the first day and $M=3$ gallons on each of the next two days.

Note that the large size of integers involved in this problem may require the use of 64-bit integer data types (e.g., a "long long" in C/C++).

출처

Olympiad > USA Computing Olympiad > 2019-2020 Season > USACO 2020 January Contest > Silver 2번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /