提交时间:2022-07-20 12:38:38
运行 ID: 52979
#include<bits/stdc++.h> #define I using #define love namespace #define Elaina std #define ll long long I love Elaina; const int N=5010; const ll mod=1e9+7; ll read(){ ll x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-')f=-1; ch=getchar(); } while(ch>='0'&&ch<='9'){ x=(x<<3)+(x<<1)+ch-'0'; ch=getchar(); } return x*f; } ll n,m,k,f[N][N],qwq[N]; ll qp(ll x,ll p){ ll res=1; while(p){ if(p&1)res=1ll*res*x%mod; x=1ll*x*x%mod,p>>=1; } return res; } ll add(ll x,ll y){ return x+y>=mod?x+y-mod:x+y; } int main(){ n=read(),k=read(),m=read(); for(int i=1;i<=n;i++)qwq[i]=qp(i,m); for(int i=1;i<=n;i++){ for(int j=1;j<=k;j++){ if(j-1+i>n)break; for(int l=j-1+i;l<=min(1ll*i*j,n);l++)f[j][l]=add(f[j][l],add(f[j-1][l-i],qwq[i])); } } printf("%lld",f[k][n]); return 0; }