題目
https://ac.nowcoder.com/acm/contest/1104/A
解題思路
顯然有先手優勢,無論怎麼改,都可以通過連續的手段將序列改爲全部都是0。
那麼答案是
快速冪裸題。
代碼
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
const ll qh=998244353;
ll n;
ll ksm(ll x,ll y){
ll ans=1;
for(;y;y>>=1,(x*=x)%=qh) if (y&1) (ans*=x)%=qh;
return ans;
}
int main(){
scanf("%lld",&n);
printf("%lld",ksm(2,n));
}