hiho week 168 register

Ended

Participants:818

Verdict:Accepted
Score:100 / 100
Submitted:2017-09-16 20:27:31

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
23
24
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
long long solve(long long n)
{
    if(n==0)    return 1;
    if(n%2==0) return solve(n>>1)+solve((n>>1)-1);
    else    return solve(n>>1);
}
int main()
{
    long long n;
    while(scanf("%lld",&n)!=EOF)
    {
        printf("%lld\n",solve(n));
    }
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX