危险行为请勿模仿
2025-01-16 19:24:40
发布于:广东
15阅读
0回复
0点赞
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int a[100005];
int main(){
cin.tie(nullptr) -> sync_with_stdio(0);
cout.tie(nullptr) -> sync_with_stdio(0);
int n;
cin >> n;
n++;
int ans = log2(n);
cout << (1ll << ans + ((n & (-n)) != n)) - 1;
return 0;
}
这里空空如也
有帮助,赞一个