Submit | All submissions | Best solutions | Back to list |
HS11CNSM - Coins on the Matrix |
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?
Input
Three space-separated integers N, M (1<=N,M<=10^6) and K (0<=K<=1000).
Output
The expected number of heads.
Example
Input: 2 1 1 Output: 0.000000
Example
Input: 2 2 1 Output: 1.000000
Note: The judge program ignores floating point rounding up to 10^-2.
Scoring
By solving this problem you score 10 points.
Added by: | Yandry Perez |
Date: | 2011-09-29 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 CLOJURE PERL6 |
Resource: | High School Programming League |