提交时间:2022-04-13 13:38:51
运行 ID: 48468
#include <iostream> #define ll long long using namespace std; ll f[26][10010]; const ll MOD = 998244353; ll Fp(ll a,ll b) { ll res = 1; while(b) { if(b&1) res*=a%=11; a*=a%=11; b>>=1; } return (res + 11) % 11; } int main() { int n,K,k1,k2,i,j,k; cin>>n>>K>>k1>>k2; const ll AKIOI = n * K * 10; //防越界 f[2][Fp(k1,n) * k1 + Fp(k1,n - 1) * k2 + AKIOI] = 1; for(i = 1;i <= n + 1;i++) { for(j = -AKIOI;j <= AKIOI;j++) { for(k = -K;k <= K;k++) { int z = Fp(k1,n - i + 1) * k; f[i][j + AKIOI]+=f[i - 1][j - z + AKIOI]; } } } cout<<f[n + 1][k2 + AKIOI] % MOD; return 0; }