[POJ1113]Walls——[凸包]

【原题】
Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the King’s castle. The King was so greedy, that he would not listen to his Architect’s proposals to build a beautiful brick wall with a perfect shape and nice tall towers. Instead, he ordered to build the wall around the whole castle using the least amount of stone and labor, but demanded that the wall should not come closer to the castle than a certain distance. If the King finds that the Architect has used more resources to build the wall than it was absolutely necessary to satisfy those requirements, then the Architect will loose his head. Moreover, he demanded Architect to introduce at once a plan of the wall listing the exact amount of resources that are needed to build the wall.
在这里插入图片描述
Your task is to help poor Architect to save his head, by writing a program that will find the minimum possible length of the wall that he could build around the castle to satisfy King’s requirements.

The task is somewhat simplified by the fact, that the King’s castle has a polygonal shape and is situated on a flat ground. The Architect has already established a Cartesian coordinate system and has precisely measured the coordinates of all castle’s vertices in feet.

【题目翻译】

给出N个点(3 <= N <= 1000)和一个正整数L(1 <= L <= 1000)

求一种包围方式,使得N个点均被包住,边界与每个点距离大于等于L

要求输出周长最短的包围方式

【输入格式】

第一行两个数N和L

接下来N行每行两个数xi,yi表示第i个点的坐标

【输出格式】

一行,你的答案

S a m p l e    I n p u t Sample~~Input Sample  Input

9 100
200 400
300 400
300 300
400 300
400 400
500 400
500 200
350 200
200 200

S a m p l e    O u t p u t Sample~~Output Sample  Output

1628

【题意分析】

首先,求凸包是很明显的

那么我们跑完一边凸包之后,该怎么得到答案呢?

举个例子

在这里插入图片描述

我们跑完了凸包,然后我们的答案就是

在这里插入图片描述

上图中外围的一圈。

那么很明显,答案中由凸包平移出的长度依然存在,再加上五个蓝色扇形的弧形总长是 2 π 2\pi 2π

额你要不信的话

在这里插入图片描述
并且通过目测就可以得到此结论。

严格证明:若设凸包边数为N,那么各扇形圆心角总和为

2 π ∗ N − π ( N − 2 ) − π 2 ∗ 2

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值