提交时间:2023-12-09 09:28:41

运行 ID: 114790

# include <bits/stdc++.h> using namespace std ; int c [114514] ; int main ( ) { int m , n ; cin >> n >> m ; c [1] = 1 ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = i - 1 ; ( j >= 1 && i - m <= j ) ; j -- ) { c [i] += c [j] ; } } cout << c [n] << endl ; return 0 ; }