[CF959E]Mahmoud and Ehab and the xor-MST题解

解法
又是一道结论题?
我的做法比较奇怪且没有证明

#include <cstdio>
#include <cmath>
#define ll long long

int main(){
    ll ans = 0;
    ll n, bs = 1;
    scanf("%I64d", &n);
    while (n > 1){
        ans += (n >> 1) * bs;
        n -= (n >> 1);
        bs <<= 1;
    }
    printf("%I64d", ans);
    return 0;
}

如果没看懂,请去
CF官方题解及其证明

posted @ 2019-05-20 19:19  LinZhengmin  阅读(182)  评论(0编辑  收藏  举报

Contact with me