結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー mbanmban
提出日時 2017-01-05 09:11:54
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 5,000 ms
コード長 1,689 bytes
コンパイル時間 2,587 ms
コンパイル使用メモリ 105,944 KB
実行使用メモリ 24,076 KB
最終ジャッジ日時 2023-08-22 12:20:27
合計ジャッジ時間 5,568 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
23,992 KB
testcase_01 AC 61 ms
21,824 KB
testcase_02 AC 62 ms
19,772 KB
testcase_03 AC 63 ms
21,872 KB
testcase_04 AC 60 ms
24,076 KB
testcase_05 AC 60 ms
22,012 KB
testcase_06 AC 61 ms
21,896 KB
testcase_07 AC 60 ms
21,832 KB
testcase_08 AC 61 ms
21,892 KB
testcase_09 AC 60 ms
23,776 KB
testcase_10 AC 61 ms
21,872 KB
testcase_11 AC 64 ms
21,844 KB
testcase_12 AC 60 ms
22,036 KB
testcase_13 AC 62 ms
21,896 KB
testcase_14 AC 64 ms
21,996 KB
testcase_15 AC 61 ms
21,868 KB
testcase_16 AC 62 ms
21,952 KB
testcase_17 AC 60 ms
21,792 KB
testcase_18 AC 63 ms
21,940 KB
testcase_19 AC 60 ms
19,956 KB
testcase_20 AC 63 ms
23,948 KB
testcase_21 AC 63 ms
23,860 KB
testcase_22 AC 62 ms
19,972 KB
testcase_23 AC 62 ms
21,900 KB
testcase_24 AC 62 ms
21,876 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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;
    }
    
}
0