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: | ADA95 ASM32 BASH BF C CSHARP C++ 4.3.2 CPP C99 CLPS CLOJURE LISP sbcl LISP clisp D ERL FSHARP FORTRAN GO HASK ICON ICK JAVA JS-RHINO LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PERL6 PHP PIKE PRLG-swi PYTHON PYTHON3 RUBY SCALA SCM guile SCM qobi ST TCL WHITESPACE |
Resource: | High School Programming League |