QOJ.ac

QOJ

Süre Sınırı: 1 s Bellek Sınırı: 2048 MB Toplam puan: 100

#8677. Carl 嘅假期

İstatistikler

螞蟻 Carl 又返嚟喇!行過蜿蜒嘅小路(2004 年世界總決賽 A 題),又喺八面體上面周圍行(2009 年世界總決賽 C 題)之後,係時候放個小假——去觀光喇!有邊度比高聳建築物嘅頂端,例如金字塔,更適合睇風景呢!!想睇高大嘅金字塔,又有邊度好得過埃及呢!!!(真係好興奮呀!!!!!)

喺一座金字塔嘅頂端睇完風景之後,Carl 想去另一座金字塔嘅頂端。螞蟻唔太受得住猛烈陽光,所以佢想搵出呢兩座金字塔頂端之間最短嘅步行距離,假設佢只可以喺金字塔表面同金字塔所在嘅平面上面行。幾何上,呢啲金字塔都係正四角錐,即係話,頂點喺正方形底面中心嘅正上方。

problem_8677_3813366f844ac8208fc4d993aa17c6f6.png

圖 D.1:對應樣例輸入 1 嘅兩座金字塔示意圖。黑線表示兩個頂點之間嘅最短路徑。

輸入格式

輸入第一行有五個整數 $x_1,y_1,x_2,y_2,h$,其中 $x_1,y_1,x_2,y_2$($-10^5 \le x_1,x_2,y_1,y_2 \le 10^5$ 而且 $(x_1,y_1) \ne (x_2,y_2)$)定義第一座金字塔嘅一條邊,金字塔主體喺由 $(x_1,y_1)$ 指向 $(x_2,y_2)$ 嘅有向向量左邊,而 $h$($1 \le h \le 10^5$)係金字塔嘅高度。第二行用相同格式描述第二座金字塔。兩座金字塔底面嘅交集面積係 $0$。

輸出格式

輸出 Carl 喺兩座金字塔頂端之間要行嘅最短距離。答案嘅絕對誤差或者相對誤差最多係 $10^{-6}$。

樣例

輸入格式 1

0 0 10 0 4
9 18 34 26 42

輸出格式 1

60.866649532

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.