编程介的小学生 2017-09-30 13:45 采纳率: 20.5%
浏览 629
已采纳

Boomerang

Problem Description
Australia original inhabitants used to hunt by a weapon called "boomerang". When a boomerang is thrown out, it rotates, hits the target, and then return to the thrower. ZXX is the best boomerang thrower in Australia. His skill is so wonderful that his boomerang can do any rotation he wants in the air. He travels around to show his skill and make money. One of his classic show is to throw out the boomerang, and it will pass through between two very close pillars. Of course the boomerang must fly parallel to the ground. If not so, everybody can do it. ZXX always puts the two pillars as close as possible to show his skill, but he wants you to figure out the smallest distance between two pillars which allows his boomerang to go through.

To simplify the problem, you can consider the boomerang as a simple polygon in a 2D plane, and each of its edge is parallel to x-axis or y-axis. Each interior angle is either 90 degrees or 270 degrees. Two pillars can be considered as two points.

This illustration simply shows how a boomerang passes through two pillars:

Input
The input consists of several test cases (less than 500).Each test case begins with an integer n (4<=n<=8), representing the number of vertices of a polygon. Next n lines give coordinates of n vertices in order. Each line contains two integers xi, yi(|xi|, |yi|<=100000). For each test case there are no two vertices is in the same place.

Input ends with n=0.

Output
For each test case, print a single real number w, representing the minimum distance to ensure the boomerang can pass through. The answer should be rounded to 2 digits after the decimal point.

Sample Input
6
0 0
100 0
100 1
1 1
1 100
0 100
8
0 0
30 0
30 30
20 30
20 10
10 10
10 30
0 30
0

Sample Output
1.41
14.14

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-10-17 08:38
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何提取csv文件中需要的列,将其整合为一篇完整文档,并进行jieba分词(语言-python)
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
  • ¥15 NX MCD仿真与博途通讯不了啥情况
  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题
  • ¥15 求大家看看Nonce如何配置
  • ¥15 Matlab怎么求解含参的二重积分?