P8177题解
lichengyun · · 题解
本蒟蒻提供一种单组询问
由对称性,我们只考虑区间
令
(
综上,最多可添加
代码
#include <bits/stdc++.h>
using namespace std;
int main(){
int T,n,a,d;
//I/O流优化
ios::sync_with_stdio(false);
cin.tie(0);
cin>>T;
while(T--){
cin>>n>>a>>d;
cout<<(1ll*(n-1)*((d&(-d))-1))<<endl;
}
return 0;
}