题解 | #查找输入整数二进制中1的个数#
查找输入整数二进制中1的个数
https://www.nowcoder.com/practice/1b46eb4cf3fa49b9965ac3c2c1caf5ad
const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void (async function () {
let n ;
while (/\d/.test(n = parseInt(await readline()))) {
let cnt = 0;
while (n) {
n &= n - 1;
cnt++;
}
console.log(cnt);
}
})();