【原题】
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