7074.Coding Company

Time Limit: 1s Memory Limit: 512MB

Your company has $n$ coders, and each of them has a skill level between $0$ and $100$ . Your task is to divide the coders into teams that work together.

Based on your experience, you know that teams work well when the skill levels of the coders are about the same. For this reason, the penalty for creating a team is the skill level difference between the best and the worst coder.

In how many ways can you divide the coders into teams such that the sum of the penalties is at most $x$ ?

Input Format(From the terminal/stdin)

The first input line has two integers $n$ and $x$ : the number of coders and the maximum allowed penalty sum.

The next line has $n$ integers $t_1,t_2,\dots,t_n$ : the skill level of each coder.

  • $1 \le n \le 100$
  • $0 \le x \le 5000$
  • $0 \le t_i \le 100$

Output Format(To the terminal/stdout)

Print one integer: the number of valid divisions modulo $10^9+7$ .

Sample Input

Copy
3 2
2 5 3
 · \n
 · · \n

Sample Output

Copy
3
 \n
Source: CSES, Additional Problems II, 1665

Submit

请先 登录

© 2025 FAQs