#include #include #include #include using namespace std; using ll = long long; template using grid = vector>; #define REP(i,n) for(ll i=0;i<(ll)(n);i++) #define REPD(i,n) for(ll i=n-1;i>=0;i--) #define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++) #define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--) #define input(...) __VA_ARGS__; in(__VA_ARGS__) void print() { std::cout << std::endl; } template void print(Head&& head, Tail&&... tail) { std::cout << head << " "; print(std::forward(tail)...); } void in() { } template void in(Head&& head, Tail&&... tail) { cin >> head; in(std::forward(tail)...); } int main() { int input(N, d, K); vector dp(K + 1); REP(k, K + 1) { // n == 1 の時 if (k <= 0) dp[k] = 0; else dp[k] = (int) k <= d; } vector cumsum(K + 1); REP(n, N - 1) { // [0, N - 1) FORD(k, K, 1) { // [K, 1] partial_sum(dp.begin(), dp.end(), cumsum.begin()); dp[k] = cumsum[k - 1] - cumsum[max(1ll, k - d) - 1]; // cumsum[a] - cumsum[b - 1] = sum(dp[b] ~ dp[a]) } } print(dp[K]); }