题解 | #求int型正整数在内存中存储时1的个数#
求int型正整数在内存中存储时1的个数
https://www.nowcoder.com/practice/440f16e490a0404786865e99c6ad91c9
num_input = input(''); num_2 = dec2bin(num_input); str_2 = num2str(num_2); ind_all = strfind(str_2,'1'); printf("%d\n",sum(length(ind_all)));