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

建议使用的浏览器:

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

6207:Bomberman

题目描述
The story begins with bomberman growing bored of making bombs in an underground factory of the Bungeling Empire. After hearing a rumor that robots reaching his surface become human, he decides to escape. When he does, he transform into an organic human being. To distinguish him from other bombermen, our main character is given the name White Bomber. However another bomberman, known as Black Bomber is an enemy due to a programming error, trying to destroy the entire map.
A two dimensional lattice with a coefficient $H~(4\le H\le 100)$ describes the map. All pairs of integers $(x,y)$ satisfying $x+y=H$ or $x+y=H+1$ but $(0,H+1),(0,-H-1),(H+1,0)$ and $(-H-1,0)$ make up the range. Were a bomb deployed at a grid $(x,y)$ by Black Bomber, all grids around it would disappear, including $(x-1,y-1)$, $(x-1,y)$, $(x-1,y+1)$, $(x,y-1)$, $(x,y)$, $(x,y+1)$, $(x+1,y-1)$, $(x+1,y)$ and $(x+1,y+1)$ if exist.

The location of the bomb is an uniformly random every time when Black Bomber deploys it, but bombs can not be placed at disappeared grids. Black Bomber deploys a bomb and ignites it, then deploys anothor bomb and ignites it again. He stops if the whole map has been destroyed. Help White Bomber calculate the expected number of bombs which would be deployed by Black Bomber. Furthermore, if White Bomber has discovered the first grid which Black Bomber would select, what is the expected number of bombs that would be deployed.
输入解释
The first line is an integer $T~(1\le 100\le T)$ which is the number of test cases.
For each test case, there is a line containing an integer $H~(4\le H\le 100)$.
输出解释
For each test case, output two lines.
The first contains the the expected number of bombs deployed with the precision of $6$ digits.
The second line contains expected numbers if the first grid has been confirmed.
Output $8H$ floats numbers with $6$ places in a line corresponding to all grids in the clockwise direction and the first one indicates the situation of the top position $(0,H)$.
输入样例
2
4
5
输出样例
9.242411
9.138479 9.441946 9.066139 9.078795 9.627045 9.078795 9.066139 9.441946 9.138479 9.441946 9.066139 9.078795 9.627045 9.078795 9.066139 9.441946 9.138479 9.441946 9.066139 9.078795 9.627045 9.078795 9.066139 9.441946 9.138479 9.441946 9.066139 9.078795 9.627045 9.078795 9.066139 9.441946 
11.430268
11.321153 11.580865 11.323971 11.357984 11.562263 11.331363 11.562263 11.357984 11.323971 11.580865 11.321153 11.580865 11.323971 11.357984 11.562263 11.331363 11.562263 11.357984 11.323971 11.580865 11.321153 11.580865 11.323971 11.357984 11.562263 11.331363 11.562263 11.357984 11.323971 11.580865 11.321153 11.580865 11.323971 11.357984 11.562263 11.331363 11.562263 11.357984 11.323971 11.580865 
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6207

最后修改于 2020-10-25T23:29:19+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
3000/3000MS(Java/Others) 65535/32768K(Java/Others)