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

#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官方题解及其证明

相关文章:

  • 2021-07-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-06
  • 2021-12-27
猜你喜欢
  • 2022-12-23
  • 2021-09-26
  • 2021-09-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案