結果
問題 | No.55 正方形を描くだけの簡単なお仕事です。 |
ユーザー |
![]() |
提出日時 | 2017-01-05 09:11:54 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 31 ms / 5,000 ms |
コード長 | 1,689 bytes |
コンパイル時間 | 4,748 ms |
コンパイル使用メモリ | 108,620 KB |
実行使用メモリ | 19,328 KB |
最終ジャッジ日時 | 2024-12-16 09:16:11 |
合計ジャッジ時間 | 4,572 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
コンパイルメッセージ
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;using System.Collections.Generic;using System.Collections.Specialized;using System.Text;using System.Text.RegularExpressions;using System.Linq;class Magatro{static XY[] points = new XY[3];static void Main(){int[] s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();for(int i = 0; i < 3; i++){points[i] = new XY(s[i * 2], s[i * 2 + 1]);}for(int i = 0; i < 3; i++){for(int j = 0; j < 3; j++){for(int k = 0; k < 3; k++){if (i == j || i == k || k == j){continue;}XY ve1 = points[i] - points[j];XY ve2 = points[j] - points[k];if(ve1==new XY(-ve2.Y, ve2.X)){XY ans = points[k] + ve1;Console.WriteLine("{0} {1}", ans.X, ans.Y);return;}}}}Console.WriteLine(-1);}}struct XY{public int X, Y;public XY(int x, int y){X = x;Y = y;}static public XY operator +(XY a, XY b){return new XY(a.X + b.X, a.Y + b.Y);}static public XY operator -(XY a, XY b){return new XY(a.X - b.X, a.Y - b.Y);}static public bool operator ==(XY a,XY b){return a.X == b.X && a.Y == b.Y;}static public bool operator !=(XY a,XY b){return a.X != b.X || b.Y != a.Y;}}