結果
問題 | No.55 正方形を描くだけの簡単なお仕事です。 |
ユーザー | nanophoto12 |
提出日時 | 2014-11-03 01:41:51 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,687 bytes |
コンパイル時間 | 2,892 ms |
コンパイル使用メモリ | 110,160 KB |
実行使用メモリ | 29,968 KB |
最終ジャッジ日時 | 2024-06-09 18:53:52 |
合計ジャッジ時間 | 2,108 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 24 ms
19,712 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 23 ms
19,712 KB |
testcase_05 | AC | 24 ms
19,456 KB |
testcase_06 | AC | 24 ms
19,712 KB |
testcase_07 | AC | 25 ms
19,456 KB |
testcase_08 | AC | 24 ms
19,840 KB |
testcase_09 | AC | 23 ms
19,456 KB |
testcase_10 | AC | 25 ms
19,712 KB |
testcase_11 | WA | - |
testcase_12 | AC | 24 ms
19,584 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 23 ms
19,328 KB |
testcase_16 | WA | - |
testcase_17 | AC | 23 ms
19,584 KB |
testcase_18 | WA | - |
testcase_19 | AC | 23 ms
19,712 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Drawing; using System.Linq; class Program { public static int DistanceSquare(Point first, Point second) { var dx = first.X - second.X; var dy = first.Y - second.Y; return dx*dx + dy*dy; } private static Point ToVector(Point first, Point second) { return new Point(second.X - first.X, second.Y - first.Y); } private static bool IsDiagnostic(Point firstVector, Point secondVector) { if (firstVector.X*secondVector.X + firstVector.Y*secondVector.Y == 0) { return true; } return false; } private static Point CreateFourth(Point opposite, Point lineStart, Point lineEnd) { var x = opposite.X + (lineStart.X + lineEnd.X)/2; var y = opposite.Y + (lineStart.Y + lineEnd.Y)/2; return new Point(x, y); } public static void Main(string[] args) { var values = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); Point[] points = new Point[3]; points[0] = new Point(values[0], values[1]); points[1] = new Point(values[2], values[3]); points[2] = new Point(values[4], values[5]); if (DistanceSquare(points[0], points[1]) == DistanceSquare(points[1], points[2])) { if (!IsDiagnostic(ToVector(points[1], points[0]), ToVector(points[2], points[1]))) { Console.WriteLine(-1); return; } var fourth = CreateFourth(points[1], points[0], points[2]); Console.WriteLine("{0} {1}", fourth.X, fourth.Y); return; } if (DistanceSquare(points[0], points[2]) != DistanceSquare(points[1], points[2])) { if (!IsDiagnostic(ToVector(points[2], points[0]), ToVector(points[2], points[1]))) { Console.WriteLine(-1); return; } var fourth = CreateFourth(points[2], points[0], points[1]); Console.WriteLine("{0} {1}", fourth.X, fourth.Y); return; } if (DistanceSquare(points[0], points[1]) != DistanceSquare(points[0], points[2])) { if (!IsDiagnostic(ToVector(points[1], points[0]), ToVector(points[2], points[0]))) { Console.WriteLine(-1); return; } var fourth = CreateFourth(points[0], points[2], points[1]); Console.WriteLine("{0} {1}", fourth.X, fourth.Y); return; } Console.WriteLine(-1); } }