当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3520:Lowest Pyramid

Special Judge 特殊评判
题目描述

You are constructing a triangular pyramid with a sheet of craft paper with grid lines. Its base and sides are all of triangular shape. You draw the base triangle and the three sides connected to the base on the paper, cut along the outer six edges, fold the edges of the base, and assemble them up as a pyramid.

You are given the coordinates of the base’s three vertices, and are to determine the coordinates of the other three. All the vertices must have integral X- and Y-coordinate values between −100 and +100 inclusive. Your goal is to minimize the height of the pyramid satisfying these conditions. Figure 3 shows some examples.


Figure 3: Some craft paper drawings and side views of the assembled pyramids
输入解释

The input consists of multiple datasets, each in the following format.

X0 Y0 X1 Y1 X2 Y2

They are all integral numbers between −100 and +100 inclusive. (X0, Y0), (X1, Y1), (X2, Y2) are the coordinates of three vertices of the triangular base in counterclockwise order.

The end of the input is indicated by a line containing six zeros separated by a single space.

输出解释

For each dataset, answer a single number in a separate line. If you can choose three vertices (Xa, Ya), (Xb, Yb) and (Xc, Yc) whose coordinates are all integral values between −100 and +100 inclusive, and triangles (X0, Y0)–(X1, Y1)–(Xa, Ya), (X1, Y1)–(X2, Y2)–(Xb, Yb), (X2, Y2)–(X0, Y0)–(Xc, Yc) and (X0, Y0)–(X1, Y1)–(X2, Y2) do not overlap each other (in the XY-plane), and can be assembled as a triangular pyramid of positive (non-zero) height, output the minimum height among such pyramids. Otherwise, output −1.

You may assume that the height is, if positive (non-zero), not less than 0.00001. The output should not contain an error greater than 0.00001.

输入样例
0 0 1 0 0 1
0 0 5 0 2 5
-100 -100 100 -100 0 100
-72 -72 72 -72 0 72
0 0 0 0 0 0
输出样例
2
1.49666
-1
8.52936

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Japan 2007

源链接: POJ-3520

最后修改于 2020-10-29T07:03:35+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
5000 65536