0 人解决,4 人已尝试。
0 份提交通过,共有 33 份提交。
9.9 EMB 奖励。
单点时限: 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.
3 2 0 0
0.705882
0 人解决,4 人已尝试。
0 份提交通过,共有 33 份提交。
9.9 EMB 奖励。