Manthan, Codefest 18 (rated, Div. 1 + Div. 2)
A
Packets
Codeforces
1300
原题
←B →
翻译中…

You have $n$ coins, each of the same value of $1$.

翻译中…

Distribute them into packets such that any amount $x$ ($1 \leq x \leq n$) can be formed using some (possibly one or all) number of these packets.

翻译中…

Each packet may only be used entirely or not used at all. No packet may be used more than once in the formation of the single $x$, however it may be reused for the formation of other $x$'s.

翻译中…

Find the minimum number of packets in such a distribution.

翻译中…

Input

翻译中…

The only line contains a single integer $n$ ($1 \leq n \leq 10^9$) — the number of coins you have.

翻译中…

Output

翻译中…

Output a single integer — the minimum possible number of packets, satisfying the condition above.

翻译中…

Note

翻译中…

In the first example, three packets with $1$, $2$ and $3$ coins can be made to get any amount $x$ ($1\leq x\leq 6$).

翻译中…
  • To get $1$ use the packet with $1$ coin.
  • To get $2$ use the packet with $2$ coins.
  • To get $3$ use the packet with $3$ coins.
  • To get $4$ use packets with $1$ and $3$ coins.
  • To get $5$ use packets with $2$ and $3$ coins
  • To get $6$ use all packets.
翻译中…

In the second example, two packets with $1$ and $1$ coins can be made to get any amount $x$ ($1\leq x\leq 2$).

翻译中…

样例

Input #1
6
Output #1
3
InputCopy OutputCopy
Input #2
2
Output #2
2
InputCopy OutputCopy
题目信息
题号
1037A
时间限制
1 s
内存限制
256 MB
标签
构造
贪心
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。