using System; using System.Collections.Generic; using System.Linq; struct Vec2 { public int X { get; private set; } public int Y { get; private set; } public Vec2(int x, int y) { X = x; Y = y; } public static Vec2 operator+(Vec2 a, Vec2 b) { return new Vec2(a.X + b.X, a.Y + b.Y); } public static Vec2 operator-(Vec2 a, Vec2 b) { return new Vec2(a.X - b.X, a.Y - b.Y); } // a⋅b = |a||b|cosθ public int Dot(Vec2 other) { return X * other.X + Y * other.Y; } public int Cross(Vec2 other) { return X * other.Y - Y * other.X; } public double Magnitude() { return Math.Sqrt(X * X + Y * Y); } public override string ToString() { return string.Format("({0}, {1})", X, Y); } public static double Distance(Vec2 a, Vec2 b) { return (a - b).Magnitude(); } } class Program { static int ReadInt() { return int.Parse(Console.ReadLine()); } static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); } static string[] ReadStrings() { return Console.ReadLine().Split(); } static void Calc(Vec2 a, Vec2 b, Vec2 c) { foreach (var xs in new Vec2[][] { new[] { a, b, c }, new[] { b, a, c }, new[] { c, a, b } }) { // a:xs[0], b:xs[1], c:xs[2] var ab = xs[1] - xs[0]; var ac = xs[2] - xs[0]; if (ab.Dot(ac) == 0 && ab.Magnitude() == ac.Magnitude()) { var d = (ab + ac) + xs[0]; Console.WriteLine("{0} {1}", d.X, d.Y); return; } } Console.WriteLine(-1); // not found } static void Main() { var xs = ReadInts(); var a = new Vec2(xs[0], xs[1]); var b = new Vec2(xs[2], xs[3]); var c = new Vec2(xs[4], xs[5]); Calc(a, b, c); } }