编辑代码

#include<iostream>
#include<cstdio>
using namespace std;
int a[100005], n, k;
int main() {
	cin >> n >> k;
	a[0] = 1;
	//对前 k 阶随便跳(1 到 k 步)
	for (int i = 1;i <= k;i++) {
		for (int j = 0;j < i;j++) {
			a[i] += a[j];
		}
		a[i] %= 100003;
		
	}	
	for (int i = k+1;i <= n;i++) {
		for (int j = i - k;j < i;j++) {
			a[i] += a[j];
		}
		a[i] %= 100003;
	}
	cout << a[n] << endl;
	return 0;
}