All submissions for this problem are available.
Chef Po is organising a grand party. This time Chef wanted to show off his cooking skills to his guests so he decided to cook N dishes which will cover the dinner table of size A x B such that N=A x B. Chef wanted all his dishes to be different but because of his over confidence K dishes out of N were made similar. Now there is no time left for Chef to prepare new dishes so he is only left with the idea to place dishes in such a way so that no two dishes are placed very close. Two dishes are considered to be placed very close if they are placed side by side in a row or column. Now being a maths lover chef figured out a fact that there can be multiple possible arrangements of dishes which are valid, but he is unable to calculate this number. He asked you to help him in calculating the number of possible valid arrangements of dishes.
First line of input contains a number T, number of test cases. Each of the next T lines contains three numbers A,B and K.
For each test case print number of possible valid arrangements.
Input: 2 2 1 1 1 2 2 Output: 2 0
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, 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, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.