Hide
Problem A
Going Nuts

Gray Squirrel. Photo by Connor Danylenko
Your crazy biology professor makes the outlandish claim that the number of walnuts each squirrel stores for the winter is always a power of two. If this holds true, any given squirrel on campus is able to only store $2^{i}$ nuts for any integer $i$. Given an integer $n$, find the minimum number of squirrels ($m$) needed on campus to store $n$ nuts.
Input
The only line of input contains the integer $n$ ($0 \le n \le 1\, 000\, 000$).
Output
Print an integer representing the minimum number of squirrels $m$.
Sample Input 1 | Sample Output 1 |
---|---|
5 |
2 |
Sample Input 2 | Sample Output 2 |
---|---|
128 |
1 |
Sample Input 3 | Sample Output 3 |
---|---|
500 |
6 |
CPU Time limit
1 second
Memory limit
1024 MB
Downloads
Authors
Elena Escalas and Justin Li
Source
CodeSprintLA 2020 (UCLA ACM-ICPC)