提交时间:2023-10-07 14:01:37
运行 ID: 105693
#include <iostream> #include <cstdio> using namespace std; int a[35][35]; int main() { int n, m, f, b; cin >> n >> m; a[0][1] = 1; for (int i = 1; i <= m; i ++) { for (int j = 1; j <= n; j ++) { f = j - 1; b = j + 1; if (a == 0) f = n; if (b == n + 1) b = 1; a[i][j] = a[i - 1][f] + a[i - 1][b]; } } cout << a[m][1]; return 0; }