結果
問題 | No.55 正方形を描くだけの簡単なお仕事です。 |
ユーザー | 14番 |
提出日時 | 2016-04-06 00:10:30 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 26 ms / 5,000 ms |
コード長 | 2,751 bytes |
コンパイル時間 | 972 ms |
コンパイル使用メモリ | 110,664 KB |
実行使用メモリ | 18,560 KB |
最終ジャッジ日時 | 2024-04-26 22:19:24 |
合計ジャッジ時間 | 2,534 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 25 ms
18,048 KB |
testcase_01 | AC | 25 ms
18,304 KB |
testcase_02 | AC | 25 ms
18,304 KB |
testcase_03 | AC | 25 ms
18,560 KB |
testcase_04 | AC | 25 ms
18,304 KB |
testcase_05 | AC | 25 ms
18,304 KB |
testcase_06 | AC | 25 ms
18,432 KB |
testcase_07 | AC | 25 ms
18,048 KB |
testcase_08 | AC | 25 ms
18,176 KB |
testcase_09 | AC | 26 ms
18,432 KB |
testcase_10 | AC | 25 ms
18,432 KB |
testcase_11 | AC | 25 ms
18,304 KB |
testcase_12 | AC | 25 ms
18,176 KB |
testcase_13 | AC | 25 ms
18,432 KB |
testcase_14 | AC | 25 ms
18,560 KB |
testcase_15 | AC | 26 ms
18,432 KB |
testcase_16 | AC | 26 ms
18,432 KB |
testcase_17 | AC | 26 ms
18,048 KB |
testcase_18 | AC | 26 ms
18,432 KB |
testcase_19 | AC | 25 ms
18,304 KB |
testcase_20 | AC | 25 ms
18,304 KB |
testcase_21 | AC | 26 ms
18,560 KB |
testcase_22 | AC | 25 ms
18,304 KB |
testcase_23 | AC | 25 ms
18,432 KB |
testcase_24 | AC | 26 ms
18,432 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Text; public class Program { public void Proc(){ Reader.IsDebug = false; int[] inpt = Reader.GetInt(); int x1 = inpt[0]; int y1 = inpt[1]; int x2 = inpt[2]; int y2 = inpt[3]; int x3 = inpt[4]; int y3 = inpt[5]; int len1 = (int)(Math.Pow((x1 - x2),2) + Math.Pow((y1-y2), 2)); int len2 = (int)(Math.Pow((x1 - x3), 2) + Math.Pow(y1-y3, 2)); int aX1 = x1; int aY1 = y1; int aX2; int aY2; int aX3; int aY3; if(len1 < len2) { aX2 = x2; aY2 = y2; aX3 = x3; aY3 = y3; } else { aX2 = x3; aY2 = y3; aX3 = x2; aY3 = y2; } int tX1 = aX1 + (aY1 - aY2); int tY1 = aY1 - (aX1 - aX2); int len3 = (int)(Math.Pow(aX3 - tX1, 2) + Math.Pow(aY3 - tY1, 2)); if(len3 == 0) { int tX2 = aX3 - (aX1 - aX2); int tY2 = aY3 - (aY1 - aY2); Console.WriteLine(tX2 + " " + tY2); } else if(len3 == Math.Min(len1, len2)) { Console.WriteLine(tX1 + " " + tY1); } else { tX1 = aX1 - (aY1 - aY2); tY1 = aY1 + (aX1 - aX2); len3 = (int)(Math.Pow(aX3 - tX1, 2) + Math.Pow(aY3 - tY1, 2)); if(len3 == 0) { int tX2 = aX3 - (aX1 - aX2); int tY2 = aY3 - (aY1 - aY2); Console.WriteLine(tX2 + " " + tY2); } else if(len3 == Math.Min(len1, len2)) { Console.WriteLine(tX1 + " " + tY1); } else { Console.WriteLine(-1); } } } public static void Main(string[] args) { Program prg = new Program(); prg.Proc(); } } class Reader { public static bool IsDebug = true; private static System.IO.StringReader sr; public static string ReadLine() { if(IsDebug) { if(sr == null) { sr = new System.IO.StringReader(initStr.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } public static int[] GetInt(char delimiter = ' ') { string[] inpt = ReadLine().Split(delimiter); int[] ret = new int[inpt.Length]; for(int i=0; i<inpt.Length; i++) { ret[i] = int.Parse(inpt[i]); } return ret; } private static string initStr = @" 0 0 2 0 2 1 "; }