/* -*- coding: utf-8 -*- * * 1011.cc: No.1011 Infinite Stairs - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 300; const int MAX_D = 300; const int MAX_K = MAX_D * MAX_N; const int MOD = 1000000007; /* typedef */ /* global variables */ int dp[MAX_N + 1][MAX_K + 1]; /* subroutines */ inline void addmod(int &a, int b) { a = (a + b) % MOD; } /* main */ int main() { int n, d, k; scanf("%d%d%d", &n, &d, &k); dp[0][0] = 1; for (int i = 0; i < n; i++) { for (int j = 0; j < k; j++) if (dp[i][j] > 0) { addmod(dp[i + 1][j + 1], dp[i][j]); if (j + d < k) addmod(dp[i + 1][j + d + 1], MOD - dp[i][j]); } for (int j = 0; j < k; j++) addmod(dp[i + 1][j + 1], dp[i + 1][j]); } printf("%d\n", dp[n][k]); return 0; }