题解:AT_abc400_c [ABC400C] 2^a b^2
szh_AK_all · · 题解
为什么很多人没写出来这题啊。
考虑枚举
Code
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int n;
cin >> n;
int x = 1, ans = 0;
while (1) {
x *= 2;
int k = n / x;
if (!k)
break;
ans += (int)sqrtl(k) - ((int)sqrtl(k)) / 2;
}
cout << ans;
}