A. Packets

题目链接:http://codeforces.com/contest/1037/problem/A

A. Packets

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

You have nn coins, each of the same value of 11.

Distribute them into packets such that any amount xx (1≤x≤n1≤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 xx, however it may be reused for the formation of other xx's.

Find the minimum number of packets in such a distribution.

Input

The only line contains a single integer nn (1≤n≤1091≤n≤109) — the number of coins you have.

Output

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

Examples

input

Copy

6

output

Copy

3

input

Copy

2

output

Copy

2

Note

In the first example, three packets with 11, 22 and 33 coins can be made to get any amount xx (1≤x≤61≤x≤6).

  • To get 11 use the packet with 11 coin.
  • To get 22 use the packet with 22 coins.
  • To get 33 use the packet with 33 coins.
  • To get 44 use packets with 11 and 33 coins.
  • To get 55 use packets with 22 and 33 coins
  • To get 66 use all packets.

In the second example, two packets with 11 and 11 coins can be made to get any amount xx (1≤x≤21≤x≤2).

题目大意:给出一个数字,分解这个数字,要求分解的数字能组成这个小于这个数字的数(>0)

例如:数字6分成1,2,3,就能行成1~6的所有数字;

数论知识

#include<iostream>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
    int n;
    cin>>n;
    int x=1;
	int ans=0;
    while (x-1<n){
        x*=2;
        ans++;
    }
    printf("%d\n",ans);
}

猜你喜欢

转载自blog.csdn.net/guozuofeng/article/details/82377922