题解

FJP 2022-12-30 16:59:27 8 返回题目

#include <bits/stdc++.h> using namespace std;

int n, sum;

signed main() { cin >> n; for(int i = 0; n > 0; ++i) {
sum += (n % 2 == 1); n /= 2; } cout << sum; return 0; }

{{ vote && vote.total.up }}