思路:找到规律后是一个斐波拉契数列然后快速幂取逆即可
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 1e6+5;
#define int ll
int f[N];
int mod = 998244353;
int fastpow(int a,int b){
int res=1;
while (b) {
if (b & 1)
res = res * a % mod;
a = a * a % mod;
b >>= 1;
}
return res;
}
void solve(){
int n;cin>>n;
f[0]=f[1]=1;
for(int i =2;i<=n;i++){
f[i]=(f[i-1]+f[i-2])%mod;
}
cout<<f[n-1]*fastpow(fastpow(2, n), mod-2)%mod;
}
signed main()
{
// ios::sync_with_stdio(0);
// cin.tie(0);
// cout.tie(0);
int __ = 1;
// cin>>__;
//cin.ignore();
while (__--) {
//init();
solve();
}
}