题解 | #求int型正整数在内存中存储时1的个数#
求int型正整数在内存中存储时1的个数
https://www.nowcoder.com/practice/440f16e490a0404786865e99c6ad91c9
num = int(input()) num_2 = bin(num) number_of_1 = 0 for each in num_2: if each == '1': number_of_1 += 1 print(number_of_1)
求int型正整数在内存中存储时1的个数
https://www.nowcoder.com/practice/440f16e490a0404786865e99c6ad91c9
num = int(input()) num_2 = bin(num) number_of_1 = 0 for each in num_2: if each == '1': number_of_1 += 1 print(number_of_1)
相关推荐