11806-cheerleaders
Time limit:2.000 seconds
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem= 2906
In most professional sporting events, cheerleaders play a major role in entertaining the spectators. Their roles are substantial during breaks and prior to start of the play. The World Cup soccer is no exception. Usually the cheerleaders form a group and perform at the centre of the field. In addition to this group, some of them are placed outside the side line so they are to the closer. The organizers would like to ensure this at least one cheerleader was located on each of the four. For this problem, we'll model the playing ground as an m*n rectangular grid. The constraints for placing cheerleaders are described below:
§there should is at least one cheerleader on each of the four sides. Note this, placing a cheerleader on a corner cell would cover two sides.
§there can is at most one cheerleader in a cell.
§all the cheerleaders available must is assigned to a cell. This is, none of them can are left.
The organizers would like to know, how many ways they can place the cheerleaders while maintaining the above. Two placements are different, if there is at least one cell which contains a cheerleader in one of the placement but not I n the other.
Input
The "a" of input contains a positive integer t<=50, which denotes the number of test cases. T Lines then follow each describing one test case. Each case consists of three nonnegative integers, 2<=m, n<=20 and k<=500. Here M is the number of rows and N are the number of columns in the grid. K denotes the number of cheerleaders that must is assigned to the cells in the grid.
Output
For each case of input, there'll be one line of output. It'll contain the case number followed by the number of ways to place the cheerleaders as described earlier. Look in the sample output for exact formatting. The numbers can be arbitrarily large. Therefore you must output the answers modulo 1000007.
Meaning