#CCBCHMOT0000008. Số lần chia đôi (Halving Until Zero)
Số lần chia đôi (Halving Until Zero)
Halving Until Zero
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given nonnegative n, repeatedly replace n with the integer quotient n/2 until it becomes zero. Count how many divisions are performed. Initially zero requires none.
Input
One nonnegative integer n.
Output
Print the number of integer halvings performed.
Subtasks
- Subtask 1 (20%): 0 <= n <= 7.
- Subtask 2 (30%): 0 <= n <= 1000000.
- Subtask 3 (50%): 0 <= n <= 1000000000000000000.
Examples
Example 1
Input
5
Output
3
Explanation
5 -> 2 -> 1 -> 0 takes three divisions.
Example 2
Input
0
Output
0
Explanation
Zero needs no operation.