标签:std stdin sync 二进制 fine ica amp gic ons
打表找规律,发现结果是,2的(a二进制位为1总数)次方
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll t,a;
//freopen("in.txt","r",stdin);
cin>>t;
while(t--){
cin>>a;
ll cnt=0;
while(a){
if(a&1) cnt++;
a>>=1;
}
cout<<(1ll<<cnt)<<endl;
}
return 0;
}
B. Equations of Mathematical Magic
标签:std stdin sync 二进制 fine ica amp gic ons
原文地址:https://www.cnblogs.com/mch5201314/p/9792608.html