| 比赛 |
2025.12.13 |
评测结果 |
AAAAAAAAAA |
| 题目名称 |
勇者 |
最终得分 |
100 |
| 用户昵称 |
梦那边的美好TE |
运行时间 |
0.680 s |
| 代码语言 |
C++ |
内存使用 |
53.34 MiB |
| 提交时间 |
2025-12-13 10:52:23 |
显示代码纯文本
#include <iostream>
#include <cstdio>
using namespace std;
const int N=305;
const int mod=1e9+7;
typedef long long ll;
int n,m;
ll f[N][N][N];
int main(){
freopen("rotk.in","r",stdin);
freopen("rotk.out","w",stdout);
cin>>n>>m;
f[0][0][1]=1;
for(int i=0;i<m;i++){
for(int j=0;j<=n;j++){
for(int k=0;k<=n-j;k++){
if(!f[i][j][k])continue;
f[i+1][j+1][k]+=f[i][j][k]*(n-j-k)%mod;
f[i+1][j+1][k]%=mod;
f[i+1][j][k]+=f[i][j][k]*j%mod;
f[i+1][j][k]%=mod;
f[i+1][0][j+k]+=f[i][j][k]*k%mod;
f[i+1][0][j+k]%=mod;
}
}
}
cout<<f[m][0][n]<<endl;
return 0;
}