2219. Trees in a Wood

单点时限: 3.0 sec

内存限制: 256 MB

The saying “You can’t see the wood for the trees” is not only a cliche, but is also incorrect. The real problem is that you can’t see the trees for the wood. If you stand in the middle of a wood, the trees tend to obscure each other and the number of distinct trees you can actually see is quite small. This is especially true if the trees are planted in rows and columns, because they tend to line up. The purpose of this problem is to find how many distinct trees one can see if one were standing on the position of a tree in the middle of the wood.

For a mathematically more precise description we assume that you are situated at the origin of a coordinate system in the plane.Trees are planted at all positions {x,y}∈ Z×Z \ {(0,0)},with |x| <=a and|y|<=b.

输入格式

Each scenario consists of a line with the two numbers a and b (separated by a white space), with 1<= a<= 2,000 and 1 <= b <= 2,000,000. Input is terminated by a line with two zeros.

输出格式

For each scenario print a line containing the fraction K/N with a precision of 6 digits after the decimal point.

样例

Input
3 2
0 0
Output
0.705882

0 人解决,4 人已尝试。

0 份提交通过,共有 33 份提交。

9.9 EMB 奖励。

创建: 15 年,11 月前.

修改: 6 年,10 月前.

最后提交: 15 年,9 月前.

来源: TU Darmstadt Programming Contest 1999

题目标签