Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
26974 | 岳亦铭 | 【BJ】T3 | C++ | 通过 | 100 | 152 MS | 4992 KB | 1381 | 2024-02-28 16:20:10 |
#include <bits/stdc++.h> using namespace std; #define int long long const int maxm=1e5+10,maxn=400,mod=998244353; int n,m,k; int f[2][maxn][maxn],g[2][maxn][maxn]; int q_pow(int a,int b) { int ans=1; while(b) { if(b&1) ans=ans*a%mod; a=a*a%mod; b>>=1; } return ans; } int power[maxn]; signed main() { ios::sync_with_stdio(false); cin>>n>>m>>k; if(n>m) { cout<<0<<endl; return 0; } for(int i=1;i<=n;i++) power[i]=q_pow(i,k); bool stat=0; f[0][0][0]=0,g[0][0][0]=1; for(int i=0;i<m;i++) { for(int c1=0;c1<=n;c1++) for(int c2=0;c2<=n;c2++) f[!stat][c1][c2]=0,g[!stat][c1][c2]=0; for(int c1=0;c1<=n;c1++) { for(int c2=0;c2<=c1;c2++) { if(g[stat][c1][c2]==0) continue; for(int dl=0;dl<=1;dl++) { for(int dr=0;dr<=1;dr++) { if(c1+dl<c2+dr) continue; int nl=c1+dl,nr=c2+dr; if(nl>n) continue; // cout<<"test "<<nl<<" "<<nr<<" "<<g[stat][c1][c2]<<" "<<power[nl-nr]<<endl; f[!stat][nl][nr]=(f[!stat][nl][nr]+f[stat][c1][c2]+power[nl-nr]*g[stat][c1][c2]%mod)%mod; g[!stat][nl][nr]=(g[!stat][nl][nr]+g[stat][c1][c2])%mod; } } } } // for(int c1=0;c1<=n;c1++) // { // for(int c2=0;c2<=c1;c2++) cout<<f[!stat][c1][c2]<<" "; // cout<<endl; // } // cout<<endl; stat^=1; } cout<<f[stat][n][n]<<endl; return 0; }