hiho week 209 register

Ended

Participants:113

Verdict:Accepted
Score:100 / 100
Submitted:2018-07-01 22:58:29

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <bits/stdc++.h>
typedef long long ll; 
using namespace std;
int main()
{
  ll N;
  while(cin>>N){
     int ans = 0;
     for(int i=0;((ll)1<<i)<=N;i++){
        ll t = (ll)1<<i;
        if((N&t)==0) continue;
        ans++;
        t *= 2;
        if((N&t)==0) continue;
        N = N + t/2;
     }
     cout<<ans<<endl; 
  }
  return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX