最令人崩溃的一集
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lll __int128
#define ull unsigned ll
#define ld long double
#define db double
template<typename T>inline void read(T& x) {
x=0;int f=1;
char ch=getchar();
while(!isdigit(ch)){if(ch=='-')f=~f+1;ch=getchar();}
while (isdigit (ch)) {x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
x*=f;
}
template <typename T,typename... Args> inline void read(T& x, Args&... args) {
read(x);
read(args...);
}
template<typename T>inline void write(T x) {
static int buf[40],top=0;
if(x<0)putchar('-'),x=~x+1;
while(x)buf[++top]=x%10,x/=10;
if(top==0)buf[++top]=0;
while (top) putchar(buf[top--]^48);
putchar(' ');
}
template <typename T,typename... Args> inline void write(T x, Args... args) {
write(x);
write(args...);
}
const ll Mod=998244353;
int n,m,K;
ll dp[33][103][33][100],C[35][35],v[103];
inline ll ksm(ll a,ll b){
ll res=1;
while(b){
if(b&1)res=res*a%Mod;
a=a*a%Mod;
b>>=1;
}
return res;
}
inline void add(ll &x,ll y){
x=(x+y)%Mod;
}
int popcnt[35];
int main(){
read(n,m,K);
++m;
for(int i(1);i<=m;++i){
read(v[i]);
}
for(int i(0);i<=33;++i){
C[i][0]=1;
}
for(int i(1);i<=33;++i){
popcnt[i]=popcnt[i>>1]+(i&1);
for(int j(1);j<=i;++j){
C[i][j]=(C[i-1][j]+C[i-1][j-1])%Mod;
}
}
dp[0][0][0][0]=1;
for(int i(0);i<=n;++i){
for(int j(0);j<m;++j){
for(int k(0);k<=j;++k){
for(int p(0);p<=i;++p){
for(int h(0);h<=n-i;++h){
add(dp[i+h][j+1][(h+p)%2+k][(h+p)/2],dp[i][j][k][p]*ksm(v[j+1],h)%Mod*C[i+h][h]%Mod);
}
}
}
}
}
lll ans=0;
for(int k(0);k<=K;++k){
for(int p(0);p<=n;++p){
if(k+popcnt[p]<=K){
ans=(ans+dp[n][m][k][p])%Mod;
}
}
}
write(ans%Mod);
return 0;
}