A - 重心 解説 /

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

問題文

xy 平面上に、同一直線上にない 3 点 A(x_A,y_A),B(x_B,y_B),C(x_C,y_C) があります。
三角形 ABC の重心 G の座標 (x_G,y_G) を求めてください。

なお、三角形 ABC の重心の座標は次の式で求めることができます。

\displaystyle x_G=\frac{x_A+x_B+x_C}{3}, y_G=\frac{y_A+y_B+y_C}{3}

制約

  • -1000 \le x_A,y_A,x_B,y_B,x_C,y_C \le 1000
  • x_A,y_A,x_B,y_B,x_C,y_C はちょうど小数第 3 位まで与えられる
  • 3 点 A,B,C は同一直線上にない

入力

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

x_A y_A
x_B y_B
x_C y_C

出力

x_G, y_G をこの順に空白区切りで出力せよ。
真の解との絶対誤差が 10^{-3} 以下であるとき、出力は正解と判定される。


入力例 1

0.000 1.000
2.000 0.500
2.000 1.500

出力例 1

1.333333333333 1.000000000000

3 点 A(0,1), B(2,\frac{1}{2}), C(2,\frac{3}{2}) からなる三角形の重心の座標は G(\frac{4}{3},1) です。
よって、 1.333333333333 1.000000000000 と出力すると正解と判定されます。
10^{-3} 以下の絶対誤差が許容されるので、 1.3325 0.999 と出力しても正解と判定されます。


入力例 2

123.456 -987.654
777.777 444.444
-1000.000 1000.000

出力例 2

-32.922333333333 152.263333333333

Problem Statement

On the xy-plane, there are three points A(x_A,y_A), B(x_B,y_B), and C(x_C,y_C) that are not colinear.
Find the coordinates (x_G,y_G) of the centroid G of triangle ABC.

Note that the centroid coordinates of triangle ABC are represented as:

\displaystyle x_G=\frac{x_A+x_B+x_C}{3}, y_G=\frac{y_A+y_B+y_C}{3}.

Constraints

  • -1000 \le x_A,y_A,x_B,y_B,x_C,y_C \le 1000
  • x_A,y_A,x_B,y_B,x_C,y_C are given with exactly three decimal places.
  • The three points A, B, and C are not colinear.

Input

The input is given from Standard Input in the following format:

x_A y_A
x_B y_B
x_C y_C

Output

Print x_G, a space, and y_G in this order.
Your answer is considered correct if the absolute error from the true value is at most 10^{-3}.


Sample Input 1

0.000 1.000
2.000 0.500
2.000 1.500

Sample Output 1

1.333333333333 1.000000000000

The centroid of the triangle formed by three points A(0,1), B(2,\frac{1}{2}), C(2,\frac{3}{2}) is G(\frac{4}{3},1).
Thus, the output 1.333333333333 1.000000000000 is considered correct.
With the absolute error tolerance of 10^{-3}, the output 1.3325 0.999 is also accepted.


Sample Input 2

123.456 -987.654
777.777 444.444
-1000.000 1000.000

Sample Output 2

-32.922333333333 152.263333333333