103540: [Atcoder]ABC354 A - Exponential Plant

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:9 Solved:0

Description

Score : $100$ points

Problem Statement

Takahashi is growing a plant. Its height at the time of germination is $0\,\mathrm{cm}$. Considering the day of germination as day $0$, its height increases by $2^i\,\mathrm{cm}$ day $i$'s night $(0 \le i)$.

Takahashi's height is $H\,\mathrm{cm}$.

Every morning, Takahashi measures his height against this plant. Find the first day such that the plant's height is strictly greater than Takahashi's height in the morning.

Constraints

  • $1 \leq H \leq 10^{9}$
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

$H$

Output

Print an integer representing the first day such that the plant's height is greater than Takahashi's height in the morning.


Sample Input 1

54

Sample Output 1

6

The plant's height in the mornings of days $1, 2, 3, 4, 5, 6$ will be $1\,\mathrm{cm}, 3\,\mathrm{cm}, 7\,\mathrm{cm}, 15\,\mathrm{cm}, 31\,\mathrm{cm}, 63\,\mathrm{cm}$, respectively. The plant becomes taller than Takahashi in the morning day $6$, so print $6$.


Sample Input 2

7

Sample Output 2

4

The plant's height will be $7\,\mathrm{cm}$ in the morning of day $3$ and $15\,\mathrm{cm}$ in the morning day $4$. The plant becomes taller than Takahashi in the morning of day $4$, so print $4$. Note that, in the morning of day $3$, the plant is as tall as Takahashi, but not taller.


Sample Input 3

262144

Sample Output 3

19

Output

分数:100分

问题描述

Takahashi正在种植一株植物。发芽时它的高度为$0\,\mathrm{cm}$。以发芽的那天为第$0$天,从第$0$天的晚上开始,它的高度每天晚上增加$2^i\,\mathrm{cm}$(其中$0 \le i$)。

Takahashi的身高是$H\,\mathrm{cm}$。

每天早上,Takahashi会测量他的身高与这株植物的比较。找出第一个在早上植物高度严格高于Takahashi身高的日子。

限制条件

  • $1 \leq H \leq 10^{9}$
  • 所有输入值都是整数。

输入

输入从标准输入按以下格式给出:

$H$

输出

打印一个整数,表示第一个植物在早上的高度超过Takahashi身高的日子。


样例输入1

54

样例输出1

6

在第$1, 2, 3, 4, 5, 6$天早上的植物高度分别为$1\,\mathrm{cm}, 3\,\mathrm{cm}, 7\,\mathrm{cm}, 15\,\mathrm{cm}, 31\,\mathrm{cm}, 63\,\mathrm{cm}$。植物在第$6$天早上变得比Takahashi高,所以打印$6$。


样例输入2

7

样例输出2

4

植物在第$3$天早上高度为$7\,\mathrm{cm}$,第$4$天早上为$15\,\mathrm{cm}$。植物在第$4$天早上变得比Takahashi高,所以打印$4$。请注意,在第$3$天早上,植物和Takahashi一样高,但没有更高。


样例输入3

262144

样例输出3

19

加入题单

上一题 下一题 算法标签: