当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3766:Hexagon Coin Toss

题目描述

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.

输入解释

The input contains multiple test cases.
The first line of each case contains three integers N, M, K, representing the size of the chessboard. N and M will be in the range of [1,1000] and K equals either N or N-1. It is guaranteed that all input information is valid (So that (2, 1, 1) will not appear).
The following line is a real number R, the radius of the coin.
Input is ended with a case of N=M=K=0.

输出解释

For each test case, output the case number first.
The following 3 lines are the result information, as shown in the sample output. The result should be rounded to 0.001.
Print an empty line after each test case.

输入样例
4 5 4
0.38
4 5 3
0.26
4 2 3
0.24
0 0 0
输出样例
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.

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3766

最后修改于 2020-10-29T07:10:55+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536