Hans wants to become a glass carver (a person who creates beautiful artwork by cutting the glass). He already has a rectangular piece of glass of size w h millimeters, a diamond glass cutter and lots of enthusiasm. What he lacks is understanding of what to carve and how. In order not to waste time, he decided to PRactice the technique of carving. To do this, he makes vertical and horizontal cuts through the entire sheet. This process results in making smaller rectangular fragments of glass. Hans does not move the newly made glass fragments. In particular, a cut divides each fragment of glass that it goes through into smaller fragments. Hans doesn’t know how to make a great artwork, so he performs random cuts as follows. First, he tosses a fair coin to determine if he is going to cut the glass vertically or horizontally (that is, the probability of choosing each direction is 50%). After that, he chooses a uniformly distributed random real point on the corresponding side of the rectangle, and makes a cut through that point.All n random points and all n coin tosses are mutually independent. Hans is going to perform exactly n cuts. What he is interested in, is the fragment with the smallest area that is formed after he makes all cuts. Denote its area as
The only line of input contains three space-separated integers w, h and n (
Output the expected area of the smallest fragment formed after performing all cuts. Your answer will be considered correct if its relative error is no more than
對給定的
期望公式:
T_T 然而此題不止一個坑點。顯然計算 n=1000000 時,各種數(shù)據(jù)類型都已經(jīng)無法表示。但套用 log 和 exp 的策略可解決這個問題。因此,對期望公式加以轉(zhuǎn)換: long double 。
新聞熱點
疑難解答