|
|||||||||||||||||||
|
SPOJ time: 2012-05-25 02:23:16 |
Coins on the MatrixProblem code: HS11CNSM
I am the proud owner of a beautiful, classic, electronic puzzle. It consists of a matrix with N rows and M columns filled with coins. Whenever I select a coin, it will change from heads to tails or vice versa. Moreover, all the coins in the cells of the puzzle that share a side with it will also change. I spend entire hours trying to turn all the coins into heads but, after my success, my evil friend Rebeca starts playing and destroys my job. In each move, she will select a coin at random. Can you tell me the expected number of heads in the matrix after K moves? InputThree space-separated integers N, M (1<=N,M<=10^6) and K (0<=K<=1000). OutputThe expected number of heads. ExampleInput: 2 1 1 Output: 0.000000 ExampleInput: 2 2 1 Output: 1.000000 Note: The judge program ignores floating point rounding up to 10^-2. ScoringBy solving this problem you score 10 points.
|
||||||||||||||||||
| |||||||||||||||||||