思路
将折痕分为竖直和水平,分别考虑。对折n次,有2^n-1贡献,结合二次项定理将公式进行化简。
代码
#include
#include
#include
#include
#include
#include
#define ll long long
using namespace std;
const int maxn=6e66;
const ll mod=998244353;
const ll mod=998244353;
ll power(ll x,ll a)
{
ll ans=1;
while(a)
{
if(a&1)
{
ans=ans*x%mod;
}
x=x*x%mod;
a>>=1;
}
return ans;
}
int main()
{
std::ios::sync_with_stdio(false);cin.tie(0);
int t;cin>>t;
while(t--)
{
ll n;
cin>>n;
ll k = power(2,n);
ll inv = power(k,mod-2);
ll ans = 1 power(2,n) power(3,n) * inv * 2 % mod;
cout<<ans%mod<<endl;
}
return 0;
}