HDU1392(凸包)

题目

There are a lot of trees in an area. A peasant wants to buy a rope to surround all these trees. So at first he must know the minimal required length of the rope. However, he does not know how to calculate it. Can you help him?
The diameter and length of the trees are omitted, which means a tree can be seen as a point. The thickness of the rope is also omitted which means a rope can be seen as a line.
image
Input

The input contains one or more data sets. At first line of each input data set is number of trees in this data set, it is followed by series of coordinates of the trees. Each coordinate is a positive integer pair, and each integer is less than 32767. Each pair is separated by blank.
Zero at line for number of trees terminates the input for your program.

Output

The minimal length of the rope. The precision should be 10^-2.

Sample Input

9
12 7
24 9
30 5
41 9
80 7
50 87
22 9
45 1
50 7
0

Sample Output

243.06

意思

就是在平面给你一组点集,让你求出周长最小的多边形可以包围住全部的点。
题目翻译为给你一个区域的树,问买多长的绳子可以将它们包围起来。

思路

此题标准解法为求凸包,求出凸包后,然后求这些点之间的距离之和即为所需绳子的长度。下面简单解释下概念。

相关概念
凸包

严格的数学证明为:在一个实数向量空间V中,对于给定集合X,所有包含X的凸集的交集S被称为X的凸包。

所谓凸集,就是对于集合中任意两点x,y,若存在a属于[0,1],ax + (1 - a)y 还属于这个集合,即任意两点的线段上的点也属于这个集合,这个集合就是凸集。

我们还可以将凸包映射到几何上去理解,在一个二维平面,凸包可以想象为一个刚好包含所有点的橡皮圈。计算凸包其实就是计算求的外围(蓝线)上的点。

向量积

向量积又称

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值