fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. using namespace std;
  4. void solve(){
  5. ll n;
  6. cin>>n;
  7. while(n!=-1){
  8. int count = 0;
  9. while (n!=0){
  10. n = (n & (n << 1));
  11. count++;
  12. }
  13. cout<<count<<endl;
  14. cin>>n;
  15. }
  16. }
  17.  
  18. int main(){
  19. ll t=1;
  20. // cin>>t;
  21. while(t--){
  22. solve();
  23. }
  24. return 0;
  25. }
Success #stdin #stdout 0s 15240KB
stdin
78
65
23
94
-1
stdout
3
1
3
4