daily pastebin goal
77%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top