题解 | #求int型正整数在内存中存储时1的个数#
求int型正整数在内存中存储时1的个数
https://www.nowcoder.com/practice/440f16e490a0404786865e99c6ad91c9
import sys
n=int(input())
count=0
if n>2**32-1:
print('Input out of range!')
sys.exit()
if n==0:
print(count)
sys.exit()
while n>=2:
if n%2!=0:
count+=1
n=(n-1)/2
else:
n=n/2
if n==1:
count+=1
print(count)
