#include #include #include #include #include using namespace std; // typedef typedef long long ll; // container util #define ALL(c) (c).begin(),(c).end() #define RALL(c) (c).rbegin(), (c).rend() #define PB push_back #define EB emplace_back #define MP make_pair #define SZ(c) int((c).size()) #define EACH(i,c) for(auto (i)=(c).begin(); (i)!=(c).end(); ++(i)) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort(ALL(c)) // repetition #define FOR(i,m,n) for(ll (i) = ((ll) m); (i) < ((ll) n); ++(i)) #define RFOR(i,m,n) for(ll (i) = ((ll) (m)-1); (i) >= ((ll) n); --(i)) #define REP(i,n) FOR(i,0,n) // i/o #define TFOUT(b,t,f) cout << ((b)? (t) : (f)) << endl // constant const double EPS = 1e-10; const int INFTY = (1<<21); const ll MOD = (ll) 1e9+7; // clear memory #define CLR(a) memset((a),0,sizeof(a)) // debug #define dump(x) cerr << #x << " = " << (x) << endl #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << " " << __FILE__ << endl int main() { int n, s, k; cin >> n >> s >> k; int m = s - k*(n-1)*n/2; if(m < 0) { cout << 0 << endl; return 0; } vector dp((m+1)*n, 0); REP(i, n) { REP(j, m+1) { if (i == 0) { dp[i*(m+1)+j] = 1; continue; } ll val = dp[(i-1)*(m+1)+j]; if (j-i-1 >= 0) val += dp[i*(m+1)+j-i-1]; dp[i*(m+1)+j] = val % MOD; } } cout << *(dp.end() - 1) << endl; return 0; } /* 見栄っ張りの募金活動 https://yukicoder.me/problems/no/269 数字の間の差が一定以上であれという制約がある分割の問題は, 各数字(ai)が取りうる最小値(mi)の和Mを一致させたい和Sからあらかじめ引いておいて, その上でSの分割を求めれば良い. ある分割{bi}が得られたらそれをソートして ai = mi + bi とすれば良い. すなわち(順序をもたない)分割{bi}が順序付きの列(ai)に一対一で対応する. */