1003 Boring Game
大模拟
1009 Paperfolding
这个好像是推公式?
因为每种折法等可能出现,所以有长宽分配到不同折痕,最后推出来是这个
放个标程吧
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef double db;
#define mem(a,x) memset(a,x,sizeof(a))
#define rep_it(it,x) for (__typeof((x).begin()) it=(x).begin(); it!=(x).end(); it++)
#define ____ puts("\n_______________\n\n")
#define debug(x) ____; cout<< #x << " => " << (x) << endl
#define debug_pair(x) cout<<"\n{ "<<(x).fir<<" , "<<(x).sec<<" }\n"
#define debug_arr(x,n) ____; cout<<#x<<":\n"; rep(i,0,n+1) cout<<#x<<"["<<(i)<<"] => "<<x[i]<<endl
#define debug_arr2(x,n,m) ____; cout<<#x<<":\n"; rep(i,0,n+1) rep(j,0,m+1) cout<<x[i][j]<<((j==m)?"\n\n":" ")
#define debug_set(x) ____; cout<<#x<<": \n"; rep_it(it,x) cout<<(*it)<<" "; cout<<endl
#define debug_map(x) ____; cout<<#x<<": \n"; rep_it(it,x) debug_pair(*it)
void file_put() {
freopen("filename.in", "r", stdin);
freopen("filename.out", "w", stdout);
}
const ll P=998244353;
int T; ll n;
ll Pow(ll x, ll k) {
ll ret=1;
for (; k; k>>=1, x=x*x%P) if (k&1) ret=ret*x%P;
return ret;
}
int main() {
//file_put();
scanf("%d",&T);
while (T--) {
scanf("%lld",&n);
ll ans=1+Pow(2,n);
ll t=3ll * Pow(2,P-2) % P;
(ans+=2*Pow(t,n) % P)%=P;
printf("%lld\n",ans);
}
return 0;
}
1012 Set1
也是推公式的题目