Shy Polygons

Description

You are given two solid polygons and their positions on the xy-plane. You can move one of the two along the x-axis (they can overlap during the move). You cannot move it in other directions. The goal is to place them as compactly as possible, subject to the following condition: the distance between any point in one polygon and any point in the other must not be smaller than a given minimum distance L.
We define the width of a placement as the difference between the maximum and the minimum x-coordinates of all points in the two polygons.
Your job is to write a program to calculate the minimum width of placements satisfying the above condition.
Let's see an example. If the polygons in Figure 13 are placed with L = 10.0, the result will be 100. Figure 14 shows one of the optimal placements.

Input

The input consists of multiple datasets. Each dataset is given in the following format.
L
Polygon1
Polygon2

L is a decimal fraction, which means the required distance of two polygons. L is greater than 0.1 and less than 50.0.
The format of each polygon is as follows.
n
x1 y1
x2 y2
...
xn yn
n is a positive integer, which represents the number of vertices of the polygon. n is greater than 2 and less than 15.
Remaining lines represent the vertices of the polygon. A vertex data line has a pair of nonnegative integers which represent the x- and y-coordinates of a vertex. x- and y-coordinates are separated by a single space, and y-coordinate is immediately followed by a newline. x and y are less than 500.
Edges of the polygon connect vertices given in two adjacent vertex data lines, and vertices given in the last and the first vertex data lines. You may assume that the vertices are given in the counterclockwise order, and the contours of polygons are simple, i.e. they do not cross nor touch themselves.
Also, you may assume that the result is not sensitive to errors. In concrete terms, for a given pair of polygons, the minimum width is a function of the given minimum distance l. Let us denote the function w(l). Then you can assume that |w(L±10-7)-w(L)| < 10-4.
The end of the input is indicated by a line that only contains a zero. It is not a part of a dataset.
Output

The output should consist of a series of lines each containing a single decimal fraction. Each number should indicate the minimum width for the corresponding dataset. The answer should not have an error greater than 0.0001. You may output any number of digits after the decimal point, provided that the above accuracy condition is satisfied.
Sample Input

10.5235
3
0 0
100 100
0 100
4
0 50
20 50
20 80
0 80
10.0
4
120 45
140 35
140 65
120 55
8
0 0
100 0
100 100
0 100
0 55
80 90
80 10
0 45
10.0
3
0 0
1 0
0 1
3
0 100
1 101
0 101
10.0
3
0 0
1 0
0 100
3
0 50
100 50
0 51
0
Sample Output

114.882476
100
1
110.5005

1个回答

DRY原则和Shy原则

BZOJ 2821 作诗 （分块）

2017NOIP模拟赛 D【思维】作诗（分块）

【bzoj2821】【作诗】【分块】
Description 神犇SJY虐完HEOI之后给傻×LYD出了一题：SHY是T国的公主，平时的一大爱好是作诗。由于时间紧迫，SHY作完诗 之后还要虐OI，于是SHY找来一篇长度为N的文章，阅读M次，每次只阅读其中连续的一段[l,r]，从这一段中选出一 些汉字构成诗。因为SHY喜欢对偶，所以SHY规定最后选出的每个汉字都必须在[l,r]里出现了正偶数次。而且SHY认 为选出的汉字的种

&shy;电子商务“二元”形态之趋势分析&shy;
­电子商务“二元”形态之趋势分析­文/王易见    郎咸平教授有一个著名的“二元经济”理论，即同时存在过热和过冷两种经济形态，不过，“二元”形态不仅仅是经济现象的一个诠释，它更广泛存在于商业经济的各个行业之中。    谈到商业经济，言必称这些年崛起的电子商务，电子商务依靠互联网为平台，有别于传统线下经济，是线上经济的一种重要形态，从这个意义上说，可否将线上经济和线下经济归结于“二

Maya是美国Autodesk公司出品的世界顶级的三维动画软件，应用对象是专业的影视广告，角色动画，电影特技等。
ArcGIS切割多边形以及合并多边形

POJ 1279 Art Gallery 半平面交+求多边形核的面积

【hdu1632】半平面交模板
Polygons Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 174    Accepted Submission(s): 63 Problem Description Given two convex pol
Programming the Microsoft Windows Driver Model &auml;&cedil;&shy;&aelig;
Programming the Microsoft Windows Driver Model &auml;&cedil;&shy;&aelig;
OpenGL ES 正反面设置指令
OpenGL ES 正反面设置指令
certutil.exe

DRY原则和Shy原则 .

shy 的离散性分析

Opencv学习——图像融合
Opencv相关函数：C++: void seamlessClone(InputArray src, InputArray dst, InputArray mask, Point p, OutputArray blend, int flags)图像融合基本原理：泊松克隆，与图像的梯度和散度相关，具体的原理可查看 http://blog.csdn.net/hjimce/article/detail
ArcGIS10.0操作之七——多边形开洞
1、设置好snaping   2、选中要挖洞的多边形，用editor工具条的cut polygons tool，画出切割线要首尾相连   最后删除切割下的部分就行了，也就是把69删除就行了
FindContours的算法原理
FindContours Comments from the Wiki int cvFindContours(CvArr* image, CvMemStorage* storage, CvSeq** first_contour, intheader_size=sizeof(CvContour), int mode=CV_RETR_LIST, int method=CV_CHAI
QT开发（十四）——QT绘图系统
QT开发（十四）——QT绘图系统一、QT绘图原理    Qt4中的2D绘图系统称为Arthur绘图系统，可以使用相同的API在屏幕上和绘图设备上进行绘制，主要基于QPainter、QPainterDevice和 QPainterEngine。QPainter执行绘图操作，QPainterDevice提供绘图设备，是一个二维空间的抽象，QPainterEngine提供一些接口。QPainter用来执