Wizards and Costly Wands
All submissions for this problem are available.
In the magic kingdom of Qwan there live wizards and wandmakers. The biggest wand-making company Noogle launched their latest modular wand named Aura. The company makes parts(modules) of various power levels ranging from 1 to N. Wizards place order for wands at the showroom for wands with specific power level (which is the sum of power level of individual modules used). Help Noogle figure out what is the number of ways in which the wand can be assembled.
The first line consists of a single integer T denoting the number of testcases. Each testcase is a single line containing two space separated integers K and N denoting the power level of wand to be made and the maximum power level of module manufactured respectively.
T integers in seperate lines, each representing the number of ways in which the wand can be assemble. As the answer could be very large output it modulo 109+7
- 1 ≤ T ≤ 10
- 1 ≤ N ≤ 1000
- 1 ≤ K ≤ 1000
Input: 2 4 4 100 50 Output: 5 189477547
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions