Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Language: Hexagon Coin Toss
Description Hexagon Coin Toss is a simple game played on a Hexagon chessboard. Players toss a coin on the chessboard and see how many hexagons intersect with the coin. Now you are given a task to calculate the result of the coin toss----for each different number of intersecting hexagons, just output the probability. To simplify the problem, we assume that the side length of each hexagon is 1 and the radius of the coin will not exceed 0.5 (so that the coin can cover at most 3 hexagons). The chessboard contains several rows of hexagons and numbers of hexagons in all odd-number-row are the same (That is true for all even-number-rows). The chessboard is described as (N, M, K). Here N representing the number of hexagons in the longest row. M representing the number of rows and K shows the number of hexagons in the first row. So the chessboard above can be represented as (4, 3, 3). The center of the coin will be in the chessboard and we do not take anything outside the chessboard into consideration. In the situation below, the coin covers 2 hexagons. Input The input contains multiple test cases. Output For each test case, output the case number first. Sample Input 4 5 4 0.38 4 5 3 0.26 4 2 3 0.24 0 0 0 Sample Output Case 1: Probability of covering 1 hexagon = 48.303 percent. Probability of covering 2 hexagons = 31.300 percent. Probability of covering 3 hexagons = 20.397 percent. Case 2: Probability of covering 1 hexagon = 61.956 percent. Probability of covering 2 hexagons = 27.934 percent. Probability of covering 3 hexagons = 10.110 percent. Case 3: Probability of covering 1 hexagon = 72.550 percent. Probability of covering 2 hexagons = 22.220 percent. Probability of covering 3 hexagons = 5.230 percent. Source |
[Submit] [Go Back] [Status] [Discuss]
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator