No.1101 Runny Nose
タグ : / 解いたユーザー数 195
作問者 :
anagohirame
/ テスター :
tpyneriver
Problem Statement
Anago-kun has a cold, and his nose will not stop running.
The capacity of Anago-kun's nose is $V$mL, and snot is produced continuously at a rate of 1 mL/second. Initially, there is no snot in his nose.
If the amount of snot in his nose exceeds $V$mL (exactly $V$mL is safe), he will make a disgraceful spectacle of himself, so he wants to avoid that somehow.
To avoid the worst, Anago-kun can take the following two actions.
- Sniffle: This can be done only when the amount of snot is at least 1mL, and it instantly reduces the amount of snot by 1mL. However, doing it too much is noisy, so he cannot sniffle if the time elapsed since his last sniffle is less than $T$ seconds.
- Blow his nose: This instantly removes all the snot. However, Anago-kun has only $P$ sheets of tissue paper, so this operation can be performed at most $P$ times.
More precisely, find the maximum value of $t$ such that "for any $i$ with $0 \le i \le t$, the amount of snot $i$ seconds after the start is at most $V$mL" holds.
It is guaranteed that the answer is an integer, so output it as an integer.
Input
$V\ T\ P$
- All input values are integers.
- $1 \le V \le 10^9$
- $2 \le T \le 10^9$
- $0 \le P \le 10^9$
Output
Output the integer answer on one line, followed by a newline.
Sample
Sample 1
Input
5 4 1
Output
14
Here is an example of optimal actions.
- After 1 second: Sniffle. The amount of snot goes from 1mL to 0mL.
- After 5 seconds: Sniffle. The amount of snot goes from 4mL to 3mL.
- After 7 seconds: Blow his nose. The amount of snot goes from 5mL to 0mL.
- After 9 seconds: Sniffle. The amount of snot goes from 2mL to 1mL.
- After 13 seconds: Sniffle. The amount of snot goes from 5mL to 4mL.
- After 14 seconds: The amount of snot is 5mL, but he has no means of reducing it, so Anago-kun reaches his limit here.
Sample 2
Input
1 100000 0
Output
2
He has no tissues, and on top of that, the people around him are very strict.
Sample 3
Input
999999999 999999999 999999999
Output
1000000000000000002
The output may exceed the range of a 32-bit integer type.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。