Python代码
n, k, d = map(int, input().split())
dp = [0] * (n + 1)
dps = [0] * (n + 1)
dp[0] = dps[0] = 1
for i in range(1, n + 1):
for j in range(1, k + 1):
if i - j < 0:
break
else:
dp[i] += dp[i - j]
for p in range(1, d):
if i - p < 0:
break
else:
dps[i] += dps[i - p]
tmp = (dp[-1] - dps[-1]) % 998244353
print(tmp)