No.477 MVP
Problem Statement
This is a story about a certain RPG.
The enemy has $N$ HP. At first, you fight it as $1$ person, but if you request reinforcements, other online players come to help and multiple players can fight together.
In that case, the $K$ players who dealt the most damage become MVPs and obtain a special item.
In case of a tie (when the $K$-th player and the $K+1$-th player have dealt the same amount of damage), the MVPs are chosen at random.
Now, find the minimum amount of damage you should deal before requesting reinforcements in order to surely become an MVP.
Many of the other online players are strong, so after you request reinforcements, the enemy may be defeated before you deal any damage.
Also, if the number of players who dealt $1$ or more damage is less than $K$, all players who dealt damage become MVPs.
Input
$N$ $K$
$1 \leq N \leq 10^{18}$
$1 \leq K \leq 10^{18}$
Output
Output the answer.
Sample
Sample 1
Input
15 1
Output
8
The enemy has $15$ HP. If you deal $8$ damage and then request reinforcements, even if a player who comes to help deals $7$ damage, you will be the player who dealt the most damage.
Sample 2
Input
1000000000000000000 2
Output
333333333333333334
For example, even if 2 players come to help and deal $500000000000000000$ and $166666666666666666$ damage, you become an MVP as the player who dealt the $2$-nd most damage.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
LayCurse