簡單 時間限制:3 s記憶體限制:256 MB

Online Judge - 10242 - Fourth Point!!

來源代碼:UVa
數學CPE歷屆試題CPE一星
前往提交 ↓

Given are the (x, y) coordinates of the endpoints of two adjacent sides of a parallelogram. Find the (x, y) coordinates of the fourth point.

輸入說明

Each line of input contains eight floating point numbers: the (x, y) coordinates of one of the endpoints of the first side followed by the (x, y) coordinates of the other endpoint of the first side, followed by the (x, y) coordinates of one of the endpoints of the second side followed by the (x, y) coordinates of the other endpoint of the second side. All coordinates are in meters, to the nearest mm. All coordinates are between −10000 and +10000. Input is terminated by end of file.

輸出說明

資料格式說明

For each line of input, print the (x, y) coordinates of the fourth point of the parallelogram in meters, to the nearest mm, separated by a single space.

輸入輸出範例

範例 1

範例輸入
0.000 0.000 0.000 1.000 0.000 1.000 1.000 1.000
1.000 0.000 3.500 3.500 3.500 3.500 0.000 1.000
1.866 0.000 3.127 3.543 3.127 3.543 1.412 3.145
範例輸出
1.000 0.000
-2.500 -2.500
0.151 -0.398

範例 2

範例輸入
1.000 1.000 4.000 1.000 1.000 1.000 2.000 3.000
0.000 0.000 2.000 1.000 -1.000 2.000 0.000 0.000
5.000 -1.000 3.000 -2.000 4.500 0.500 3.000 -2.000
-3.000 0.000 -1.500 2.250 -1.500 2.250 0.500 1.000
範例輸出
5.000 3.000
1.000 3.000
6.500 1.500
-1.000 -1.250

範例 3

範例輸入
2.000 5.000 1.000 1.000 2.000 -3.000 1.000 1.000
3.000 2.000 0.000 0.000 -4.000 2.000 0.000 0.000
7.251 -1.500 7.250 -1.500 5.000 2.000 7.250 -1.500
0.100 0.700 0.300 -0.400 0.100 0.700 -0.200 -0.500
179.359 -10000.000 -465.193 -10000.000 9715.934 10000.000 179.359 -10000.000
範例輸出
3.000 1.000
-1.000 4.000
5.001 2.000
0.000 -1.600
9071.382 10000.000
開啟討論
開啟紀錄

登入後即可撰寫程式、測試範例及提交解答。

登入