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

建议使用的浏览器:

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

2824:Bohemian Rhapsody

题目描述
Is this the real life?
Or is this just fantasy?
Caught in a landslide
No escape from reality
Open your eyes
Look up to the skies and see
I'm just a poor boy, I need no sympathy
Because I'm easy come, easy go
A little high, little low
Anyway the wind blows, doesn't really matter to me…

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?

输入解释
The input consists of one or more data sets, followed by a last line containing a single zero. Each data set begins with a line containing an integer N, 1 ≤ N ≤ 500, which is the number of line segments that would be drawn. Then follow N lines, each containing two real numbers and an integer referring to Δxi, Δyi and the money that a player could win after the i-th step.
输出解释

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

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

源链接: POJ-2824

最后修改于 2020-10-29T06:45:13+00:00 由爬虫自动更新

共提交 0

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