Vasily the Bear and Fly
题意翻译
### 题目描述
一天,Vasily熊在一个坐标平面上画了 $ n $ 个半径为 $ 2m $ 的圆。编号从 $1 $ 至 $n $ 的圆的圆心分别在 $ (2R-R,0) $,$(4R-R,0)$,$...$,$(2Rm-R,0) $ 。
熊画圆是为了和苍蝇做个实验。而实验一直持续了 $n^2$ 天。每天的实验都有自己独特的编号,从 $1$ 至 $m^2 -1 $ 。
在第 $i$ 天,会发生以下这些事情:
$1.$ 苍蝇飞到了编号为 $v = \left \lfloor \frac{i}{m} \right \rfloor + 1 $ 的圆圈。( $\left \lfloor \frac{x} {y} \right \rfloor $ 是指用 $x$ 除以 $y$ 向下取整的结果)。
$ 2. $ 苍蝇穿过坐标平面,飞到编号为 $u = m + 1 + (i \mod m) $的圆圈中心。( $ x \mod y $ 是 $ x$ ${\div}$ $y $ 的余数。)
熊注意到,苍蝇从圆 $v$ 到圆 $u$ 的最短路径上的点都落在这 $2m$ 个圆的边或者内部。苍蝇接触到圆 $u$ 的圆心后就飞走了。
帮Vailsy算出这 $2m$ 天内苍蝇经过的平均距离。
题目描述
One beautiful day Vasily the bear painted $ 2m $ circles of the same radius $ R $ on a coordinate plane. Circles with numbers from $ 1 $ to $ m $ had centers at points $ (2R-R,0) $ , $ (4R-R,0) $ , $ ... $ , $ (2Rm-R,0) $ , respectively. Circles with numbers from $ m+1 $ to $ 2m $ had centers at points $ (2R-R,2R) $ , $ (4R-R,2R) $ , $ ... $ , $ (2Rm-R,2R) $ , respectively.
Naturally, the bear painted the circles for a simple experiment with a fly. The experiment continued for $ m^{2} $ days. Each day of the experiment got its own unique number from $ 0 $ to $ m^{2}-1 $ , inclusive.
On the day number $ i $ the following things happened:
1. The fly arrived at the coordinate plane at the center of the circle with number ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF336B/1b364c80eefc9bb591cfee14c9b688961a93a8ea.png) (![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF336B/2e19bbae9bd88a29fe3fe77f1d030d713103ddf9.png) is the result of dividing number $ x $ by number $ y $ , rounded down to an integer).
2. The fly went along the coordinate plane to the center of the circle number ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF336B/c14650a911b9c897e385d07e41f4fe67d4bab52b.png) (![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF336B/cb1d84ad58154eb7ea26b65d1ae0039570db9bb6.png) is the remainder after dividing number $ x $ by number $ y $ ). The bear noticed that the fly went from the center of circle $ v $ to the center of circle $ u $ along the shortest path with all points lying on the border or inside at least one of the $ 2m $ circles. After the fly reached the center of circle $ u $ , it flew away in an unknown direction.
Help Vasily, count the average distance the fly went along the coordinate plane during each of these $ m^{2} $ days.
输入输出格式
输入格式
The first line contains two integers $ m,R $ ( $ 1<=m<=10^{5} $ , $ 1<=R<=10 $ ).
输出格式
In a single line print a single real number — the answer to the problem. The answer will be considered correct if its absolute or relative error doesn't exceed $ 10^{-6} $ .
输入输出样例
输入样例 #1
1 1
输出样例 #1
2.0000000000
输入样例 #2
2 2
输出样例 #2
5.4142135624
说明
![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF336B/6102118b4e5d6ba27b3c37cb86bca9d322e9441e.png)
Figure to the second sample