UVa 11806 Cheerleaders: Combination & Reverse Thinking | | The theorem of tolerance and repulsion

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.