fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int x, k;
  5. cin >> x >> k;
  6. x = x - 1;
  7. int bit = 0;
  8. while(x > 0){
  9. bit += x & 1;
  10. x >>= 1;
  11. }
  12. cout << bit;
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0.01s 5292KB
stdin
1 0
stdout
Standard output is empty