D - Opposite 解説 /

実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 400

問題文

\mathrm{x} 軸の正の向きを右、\mathrm{y} 軸の正の向きを上とする 2 次元座標平面上に、p_0, p_1, p_2, \dots, p_{N - 1}N 個の頂点からなる正 N 角形があります。
ここで N は偶数であることが保証され、頂点 p_0, p_1, p_2, \dots, p_{N - 1} はこの順に反時計回りに並んでいます。
p_i の座標を (x_i, y_i) とします。
x_0, y_0, x_{\frac{N}{2}}, y_{\frac{N}{2}} が与えられるので、x_1, y_1 を求めてください。

制約

  • 4 \le N \le 100
  • N は偶数
  • 0 \le x_0, y_0 \le 100
  • 0 \le x_{\frac{N}{2}}, y_{\frac{N}{2}} \le 100
  • (x_0, y_0) \neq (x_{\frac{N}{2}}, y_{\frac{N}{2}})
  • 入力に含まれる値は全て整数である

入力

入力は以下の形式で標準入力から与えられる。

N
x_0 y_0
x_{\frac{N}{2}} y_{\frac{N}{2}}

出力

x_1, y_1 をこの順に空白区切りで出力せよ。
出力されたそれぞれの値について、想定解答との絶対誤差または相対誤差が 10^{-5} 以下であれば正解と判定される。


入力例 1

4
1 1
2 2

出力例 1

2.00000000000 1.00000000000

p_0 = (1, 1), p_2 = (2, 2) という情報が与えられています。
p_0, p_1, p_2, p_3 が正方形をなし、反時計回りに並んでいるという情報から残りの頂点の座標は一意に定まり、以下のようになります。

  • p_1 = (2, 1)
  • p_3 = (1, 2)

入力例 2

6
5 3
7 4

出力例 2

5.93301270189 2.38397459622

Score : 400 points

Problem Statement

On a two-dimensional coordinate plane where the \mathrm{x} axis points to the right and the \mathrm{y} axis points up, we have a regular N-gon with N vertices p_0, p_1, p_2, \dots, p_{N - 1}.
Here, N is guaranteed to be even, and the vertices p_0, p_1, p_2, \dots, p_{N - 1} are in counter-clockwise order.
Let (x_i, y_i) denotes the coordinates of p_i.
Given x_0, y_0, x_{\frac{N}{2}}, and y_{\frac{N}{2}}, find x_1 and y_1.

Constraints

  • 4 \le N \le 100
  • N is even.
  • 0 \le x_0, y_0 \le 100
  • 0 \le x_{\frac{N}{2}}, y_{\frac{N}{2}} \le 100
  • (x_0, y_0) \neq (x_{\frac{N}{2}}, y_{\frac{N}{2}})
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
x_0 y_0
x_{\frac{N}{2}} y_{\frac{N}{2}}

Output

Print x_1 and y_1 in this order, with a space in between.
Your output is considered correct when, for each value printed, the absolute or relative error from our answer is at most 10^{-5}.


Sample Input 1

4
1 1
2 2

Sample Output 1

2.00000000000 1.00000000000

We are given p_0 = (1, 1) and p_2 = (2, 2).
The fact that p_0, p_1, p_2, and p_3 form a square and they are in counter-clockwise order uniquely determines the coordinates of the other vertices, as follows:

  • p_1 = (2, 1)
  • p_3 = (1, 2)

Sample Input 2

6
5 3
7 4

Sample Output 2

5.93301270189 2.38397459622