编程介的小学生 2017-04-08 12:43 采纳率: 20.5%
浏览 980
已采纳

The Lambs

Alice's grandfather is a goatherd. One day, he asks Alice to help him shepherd a flock of lambs. But the lambs are very naughty and they run here and there. To look after the lambs better, Alice is going to use rope to circle them. But there are only a few stakes to fasten the rope. So Alice want you to help she caculate the minimal length of rope she is going to use. Suppose all the lambs stay there without moving when circling them.

It is guaranteed that all the lambs can be circled. If there is a rope cross a lamb, we think the lamb has not been circled.

show
Input

There are multiple test cases. For each test case:

The first line contains two integers, N (3 <= N <= 100) and M (1 <= M <= 1000). N is the number of the stakes, M is the number of the lambs.

The next N lines contain the coordinate (SXi, SYi) of the stakes. The last M lines contain the coordinate (LXi, LYi) of the lambs. The absolute value of all integers in the input file will not exceeds 5000.

Output

For each test case, output the minimal length of the rope. Any solution with a relative or absolute error of at most 1e-9 will be accepted.

Sample Input

4 1
0 0
2 2
0 2
2 0
1 1
4 1
0 0
1 2
2 0
0 2
1 1
Sample Output

8.000000000
6.472135955

  • 写回答

1条回答 默认 最新

  • devmiao 2017-04-08 15:09
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算