提交时间:2023-10-05 22:41:53
运行 ID: 105271
#include<bits/stdc++.h> using namespace std; int dp[50][50]; int main(){ int n,m; cin>>n>>m; dp[0][1] = 1; for (int i = 1;i <= m;i++){ dp[i][1] = dp[i - 1][n] + dp[i - 1][2]; dp[i][n] = dp[i - 1][1] + dp[i - 1][n - 1]; for (int j = 2;j < n;j++){ dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j + 1]; } } cout<<dp[m][1]<<endl; return 0; }