[BOJ 11163] Kings on a Chessboard
View as PDF
Submit solution
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text
Points:
4
Time limit:
5.0s
Memory limit:
256M
Problem types
Allowed languages
You are given a chessboard of size x × y and k identical kings, and are asked to place all the kings on the board such that no two kings can attack each other. Two kings can attack each other if they are horizontally, vertically or diagonally adjacent.</p>
Write a computer program that calculates the number of possible arrangements of the k kings on the given chessboard. Since the number of feasible arrangements may be large, reduce the number modulo 1,000,000,007.
입력 형식
The first line of the input consists of a single integer T, the number of test cases. Each of the following T lines consists of three integers x, y and k, separated by one space.</p>
- 0 < T ≤ 50
- 2 ≤ x, y ≤ 15
- 1 ≤ k ≤ x · y
For each test case, output the number of possibilities modulo 1,000,000,007.
예제 입력
4
8 8 1
7 7 16
7 7 7
3 7 15
예제 출력
64
1
2484382
0
Comments