当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。
There used to be a gambling called Bohemian Gambling. At the beginning of the game, a unit circle was drawn on a piece of paper. Then a point (x0, y0) in the circle and N (1 ≤ N ≤ 1000) vectors (Δxi, Δyi) were randomly chosen. At the i-th step of the gambling, a player draw a segment from the point (xi − 1, yi − 1) to (xi, yi), where xi = xi − 1 + Δxi and yi = yi − 1 + Δyi. If (xi, yi) was outside the circle or on its boundary, the game ended; otherwise the player would win some money and go on to the next step of the gambling until all N lines had been drawn.
As a predictor, Mercury had known all the vectors chosen for the gambling in advance, but he didn't know what the starting point would be. His clients asked him to find how much money they could win under average conditions, which meant the point would be chosen within the circle with uniformly distributed probability. They also wondered how much they could win if everything went the luckiest way. What would Mercury's reply to his clients be?
For each test case your program should output two lines. The first line gives a real number which indicates the money a player can win under average conditions and the second line an integer number which indicates the maximum amount of money he could win. Refer to the sample output for details.
The real numbers should be rounded to three digits after the decimal point.
2 1.0 1.0 100 -1.0 -1.0 50 0
Case 1: The expected amount of money: 27.254 The maximum amount of money: 150
时间上限 | 内存上限 |
6000 | 65536 |