2020牛客暑期多校训练营(第五场)I
Hard Math Problem
https://ac.nowcoder.com/acm/contest/5670/I
题目描述
You are a player of the game Mine Craft. As a lawful goo?d player, instead of dropping TNT everywhere you want to build your village on a vast plain.
The game map could be recognized as a rectangle grid. In one grid, you can set up a gold miner, or an elixir collector, or a headquarter. You also can leave some grids green and vibrant.
However, one restriction for some good reasons is that a headquarter must be next to at least one gold miner and at least one elixir collector. Next to means that their grids share one side, every grid is next to up, down, left, and right grids.
"Efficiency!" A good old man said to you. You, the vast plain holder, want to be the most efficient player in the server. You want to maximize the number of headquarters in your village. Formally, If the village is a grid of size , we define the max number of headquarters can be built as . For example, since there should be at least grids for setting up a headquarter; and one possible solution is .
To prove that you really understand the problem very well, print the efficiency on the infinite plain. Formally, you need to calculate .
输入描述
No input.
输出描述
A real number denoting the answer to the question. Round the answer to decimal places. For example, if your answer is , print .
分析
用 代表总部, 代表黄金矿工, 代表圣水收集器,如图的结构能够使总部的数量尽量多。
对于一个无穷网络,一个单元已经用虚线框出。一个总部分到 个黄金矿工和 个圣水收集器。一个单元所占格子数量为 ,一个总部占整个单元的 。
代码
PHP是世界上最好的语言!
0.666667
收集牛客暑期多校训练营的题解