提交时间:2023-12-09 08:39:06

运行 ID: 114709

#include<iostream> using namespace std; const int N = 50; long long f[N], m, n; int main(){ cin >> n >> m; f[0] = 1; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m && i - j >= 0; j++){ f[i] += f[i-j]; } } cout << f[n]; return 0; }