No.1459 I Just Want to Drop My Smartphone
タグ : / 解いたユーザー数 84
作問者 :
butsurizuki
shiomusubi496
Problem Statement
In the year $2100$, Noboru has finally achieved his long-cherished goal of developing a "very hard-to-break smartphone".
However, as things stand, people will surely think it is just like any other dubious smartphone out there.
With that in mind, Noboru decided to use the $N$-story Shinpuro Building to find the integer $A$ satisfying the following [Conditions], and to sell the smartphone with the slogan "It won't break even if dropped from floor $A$ of the Shinpuro Building".
[Conditions]
It is guaranteed that such an $A$ exists, that $A$ is the same for all smartphones, and that $A$ stays constant as long as the smartphone is not broken.
Now, Noboru has asked you to find $A$.
So you have decided to actually drop smartphones from the Shinpuro Building.
However, smartphones are very expensive, so you can use only $2$ smartphones in the experiment.
A smartphone can be dropped from the Shinpuro Building any number of times as long as it does not break, but of course a broken smartphone can no longer be used.
When you follow a strategy that makes the number of drops in the worst case as small as possible, find that number.
Input
$N$
- $1 \le N \le 10^9$
- $N$ is a positive integer
Output
Output the minimum possible number of drops in the worst case on one line, followed by a newline.
Sample
Sample 1
Input
2
Output
2
For example, the following strategy can be used.
- From floor $1$, drop smartphone number $1$. If it breaks, then $A=0$; otherwise, proceed to the next step.
- From floor $2$, drop smartphone number $2$. If it breaks, then $A=1$; otherwise, $A=2$.
With this strategy, $A$ can be determined with certainty in $2$ drops. There is no way to determine $A$ with certainty in $1$ drop or fewer, so output $2$.
Sample 2
Input
10
Output
4
Sample 3
Input
1
Output
1
That is hardly a building anymore, is it?
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。