ABC280e
算期望,考虑 dp。
设
有
边界
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e5+5,mod=998244353;
int n,p1,p2,f[N];
int qpow(int x,int y=mod-2){
int res=1;
while(y){
if(y&1)res=res*x%mod;
x=x*x%mod;y>>=1;
}
return res;
}
signed main(){
scanf("%lld%lld",&n,&p2);p2=p2*qpow(100)%mod;p1=(1+mod-p2)%mod;
f[0]=0;f[1]=1;
for(int i=2;i<=n;i++){
f[i]=(f[i-1]*p1%mod+f[i-2]*p2%mod+1)%mod;
}
printf("%lld\n",f[n]);
return 0;
}