#[allow(unused_imports)] use itertools::Itertools; #[allow(unused_imports)] use proconio::{ input, marker::{Chars, Isize1, Usize1}, }; #[allow(unused_imports)] use std::{ cmp::Reverse, cmp::{max, min}, collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, VecDeque}, process::exit, }; const DXY: [(isize, isize); 4] = [(0, 1), (0, -1), (1, 0), (-1, 0)]; const FIRST_VALUE: usize = 1_000_000_000; const MOD: usize = 1_000_000_007; #[allow(non_snake_case)] fn main() { input! { N: usize, mut S: isize, K: usize, } S -= (K * N * (N - 1) / 2) as isize; if S < 0 { println!("0"); exit(0); } let mut dp = vec![vec![0; S as usize + 1]; N + 1]; // dp[i][j] := jをi分割するときの総数 dp[0][0] = 1; for i in (1..=N) { for j in (0..=(S as usize)) { if j >= i { dp[i][j] = dp[i - 1][j] + dp[i][j - i]; dp[i][j] %= MOD; } else { dp[i][j] = dp[i - 1][j]; } } } println!("{}", dp[N][S as usize]); }