编程介的小学生 2019-11-21 17:57 采纳率: 20.5%
浏览 100

Cover the Square 请问怎么编

Problem Description
Oh no! The Enterprise is being attacked by a Borg unit cube. We all know that resistance is futile, but that won’t prevent the captain from trying anyway!

The engineers aboard the Enterprise have recently upgraded the size of the ships’s laser beam weapons, such that it can now cut large circular holes into enemy ships. In fact, they can even cut out holes of diameter one, which should get rid of most of the Borg cube in one deadly blow. However, the Borgs are frighteningly persistent, and the captain fears that the remaining undestroyed pieces will cause trouble. Thus, he wants to destroy at least n percent of the cube.

The Borg cube is positioned such that one of its faces is perpendicular to the enterprise’s line of sight, so the problem is approximately equivalent to trying to cover a unit square with circles of diameter one. Under this approximation and assuming that the undestroyed parts simply remain motionless at their original position, how many shots are required to destroy at least n percent of the cube?

Input
The first line of the input will contain m, the number of test cases. m lines will follow, each containing an integer n between 0 and 100 inclusively.

Output
For each test case, output the number of circles required to cover n percent of the square.

Sample Input
3
0
50
100

Sample Output
0
1
4

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 c程序不知道为什么得不到结果
    • ¥40 复杂的限制性的商函数处理
    • ¥15 程序不包含适用于入口点的静态Main方法
    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置