Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.18 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     unsigned int n, ans = 0; cin >> n;
  8.     for (int i = 0; n >= 1 << i; i++) ans += (bool)(n & 1 << i);
  9.     cout << ans << endl;
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement