문제
Farmer John owes Bessie
Here is how Farmer John decides to pay back Bessie. He first picks a positive integer
Assuming that Farmer John has already given Bessie
G gallons, compute\frac{N-G}{X} rounded down. Call this numberY .If
Y is less thanM , setY toM .Give Bessie
Y gallons of milk.
Determine the largest
SCORING:
Test cases 2-4 satisfy
K\le 10^5. Test cases 5-11 satisfy no additional constraints.
Problem credits: Nick Wu
입력
The only line of input contains three space-separated positive integers
출력
Output the largest positive integer
예제1
10 3 3
2
For the first test case, when
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++).