题解:B4372 [GXPC-S 2025] 异或之力 / xor
Wide_Master · · 题解
前言
打表秒出
正解
我们要想知道
我们先来看
再来看
最后可得到答案为
代码
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7;
int n;
int power(int a,int b){
int res=1;
while(b){
if(b&1)res=res*a%mod;
a=a*a%mod;
b>>=1;
}
return res;
}
signed main()
{
cin>>n;
if(n==2){cout<<0<<endl;return 0;}
cout<<(power(2,n)-2+mod)%mod<<endl;
return 0;
}