COCI 2006/2007, Contest #4
Task ZBRKA
Consider a sequence of N integers where each integer between 1 and N appears exactly once.
A pair of numbers in the sequence is confused if the number that comes earlier in the sequence is larger than the later number.
The confusion of the sequence is the number of confused pairs in it. For example, the confusion of the sequence (1, 4, 3, 2) is 3 because there are 3 confused pairs: (4, 3), (4, 2) and (3, 2).
Write a program that calculates the number of sequences of length N whose confusion is exactly C.
Input
The first and only line of input contains two integers, N (1 ≤ N ≤ 1000) and C (0 ≤ C ≤ 10 000).
Output
Output the number of sequences modulo 1 000 000 007.
Sample Tests
Input10 1 Output9 |
Input4 3 Output6 |
Input9 13 Output17957 |
All Submissions
Best Solutions
Point Value: 15 (partial)
Time Limit: 1.00s
Memory Limit: 64M
Added: Jan 29, 2009
Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Comments (Search)
It's quiet in here...