题解:P16438 [XJTUPC 2026] 共同特征
P16438 [XJTUPC 2026] 共同特征
题目意思找出
打暴力的后果
推导公式
设
代码
#include<bits/stdc++.h>
using namespace std;
//测试组数
int t;
int main(){
cin>>t;
while(t--){
//int只能存2的31次方数据,用long long
long long x;
cin>>x;
//套公式
cout<<x-(x&(x-1))<<endl;
}
return 0;
}