結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー samplelpmassamplelpmas
提出日時 2017-02-04 20:29:39
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 816 bytes
コンパイル時間 2,395 ms
コンパイル使用メモリ 73,756 KB
実行使用メモリ 57,116 KB
最終ジャッジ日時 2023-08-25 20:14:48
合計ジャッジ時間 6,639 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 125 ms
56,072 KB
testcase_02 AC 146 ms
57,020 KB
testcase_03 WA -
testcase_04 AC 125 ms
56,368 KB
testcase_05 AC 124 ms
55,868 KB
testcase_06 AC 118 ms
55,724 KB
testcase_07 AC 123 ms
55,760 KB
testcase_08 AC 123 ms
55,864 KB
testcase_09 AC 121 ms
55,508 KB
testcase_10 AC 121 ms
56,052 KB
testcase_11 WA -
testcase_12 AC 123 ms
55,832 KB
testcase_13 AC 149 ms
57,052 KB
testcase_14 WA -
testcase_15 AC 125 ms
56,140 KB
testcase_16 WA -
testcase_17 AC 122 ms
55,924 KB
testcase_18 WA -
testcase_19 AC 125 ms
55,764 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 152 ms
56,748 KB
testcase_23 WA -
testcase_24 AC 155 ms
57,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int x1 = sc.nextInt();
        int y1 = sc.nextInt();

        int x2 = sc.nextInt();
        int y2 = sc.nextInt();

        int x3 = sc.nextInt();
        int y3 = sc.nextInt();

        for (int i = 0; i < 3; i++) {

            if ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) == (x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3)) {

                if ((x1 - x2) * (x2 - x3) + (y1 - y2) * (y2 - y3) == 0) {

                    int x4 = x3 + x1 - x2;
                    int y4 = y3 + y1 - y2;

                    System.out.println(x4 + " " + y4);
                    return;

                }

            }

        }

        System.out.println(-1);

    }

}
0