#include using namespace std; #define MOD 1000000007 int main() { int n,d,k; cin >> n >> d >> k; vector> dp(n + 1, vector(k + d + 10,0)); dp[0][0] = 1;//配るDP for (int i = 1; i < n + 1; i++) { long long sumdp[k + 1] = {0}; for (int j = 0; j <= k; j++) { sumdp[j + 1] = sumdp[j] + dp[i - 1][j]; sumdp[j + 1] %= MOD; } for (int j = 0; j <= k; j++) { if(j < d) { if(sumdp[j] - sumdp[0] < 0)dp[i][j] = sumdp[j] - sumdp[0] + MOD; else dp[i][j] = sumdp[j] - sumdp[0]; dp[i][j] %= MOD; } else { if(sumdp[j] - sumdp[j - d] < 0)dp[i][j] = sumdp[j] - sumdp[j - d] + MOD; else dp[i][j] = sumdp[j] - sumdp[j - d]; dp[i][j] %= MOD; } } } //for (int i = 0; i < n + 1; i++){for (int j = 0; j < k + d + 10; j++){cout << dp[i][j] << " ";}cout << endl;} cout << dp[n][k] << endl; }