CF1037A.Packets
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You have n coins, each of the same value of 1 .
Distribute them into packets such that any amount x ( 1≤x≤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.
输入格式
The only line contains a single integer n ( 1≤n≤109 ) — the number of coins you have.
输出格式
Output a single integer — the minimum possible number of packets, satisfying the condition above.
输入输出样例
输入#1
6
输出#1
3
输入#2
2
输出#2
2
说明/提示
In the first example, three packets with 1 , 2 and 3 coins can be made to get any amount x ( 1≤x≤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≤x≤2 ).