地址:

​https://www.nowcoder.com/practice/440f16e490a0404786865e99c6ad91c9?tpId=37&tqId=21238&rp=1&ru=%2Fta%2Fhuawei&qru=%2Fta%2Fhuawei%2Fquestion-ranking&tab=answerKey​

 

1 '''
2 题目描述
3 输入一个int型的正整数,计算出该int型数据在内存中存储时1的个数。
4
5 输入描述:
6 输入一个整数(int类型)
7
8 输出描述:
9 这个数转换成2进制后,输出1的个数
10
11 示例1
12 输入
13 5
14 输出
15 2
16
17 '''
18
19 n = int(input())
20 s = bin(n)
21 print(s.count('1'))