#P6076. Chessboard Coloring
Chessboard Coloring
Chessboard Coloring
There is an ( n \times m ) chessboard divided into ( n ) rows and ( m ) columns, forming ( n \times m ) cells. You are given ( C ) different colors of paint. Each cell can either be left uncolored or painted with one of the ( C ) colors, subject to the following constraints:
- Every row must contain at least one painted cell.
- Every column must contain at least one painted cell.
- Each of the ( C ) colors must appear at least once on the board.
Two colorings are considered different if there exists at least one cell where the color (or painted/unpainted status) differs.
Calculate the total number of different valid coloring schemes.
inputFormat
The input consists of a single line containing three integers ( n ), ( m ), and ( C ) separated by spaces, representing the number of rows, columns, and available colors, respectively.
outputFormat
Output a single integer, representing the total number of valid coloring schemes that satisfy the given conditions.
sample
1 1 1
1