题解 | #查找输入整数二进制中1的个数#
while True:
try:
n = int(input())
nb = bin(n)
print(str(nb).count('1'))
except:
break
while True:
try:
n = int(input())
nb = bin(n)
print(str(nb).count('1'))
except:
break
相关推荐