結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー kano_townkano_town
提出日時 2014-11-19 22:37:38
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 737 bytes
コンパイル時間 3,671 ms
コンパイル使用メモリ 76,008 KB
実行使用メモリ 58,916 KB
最終ジャッジ日時 2023-08-30 21:53:59
合計ジャッジ時間 8,039 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 153 ms
56,924 KB
testcase_01 AC 120 ms
55,824 KB
testcase_02 AC 148 ms
56,440 KB
testcase_03 AC 149 ms
56,640 KB
testcase_04 WA -
testcase_05 AC 122 ms
56,156 KB
testcase_06 AC 123 ms
55,692 KB
testcase_07 AC 120 ms
56,016 KB
testcase_08 AC 121 ms
55,724 KB
testcase_09 AC 122 ms
55,748 KB
testcase_10 AC 121 ms
55,800 KB
testcase_11 AC 152 ms
56,900 KB
testcase_12 WA -
testcase_13 AC 146 ms
56,724 KB
testcase_14 AC 148 ms
56,900 KB
testcase_15 AC 119 ms
56,348 KB
testcase_16 AC 147 ms
56,696 KB
testcase_17 WA -
testcase_18 AC 148 ms
56,352 KB
testcase_19 AC 119 ms
55,444 KB
testcase_20 AC 146 ms
56,840 KB
testcase_21 AC 146 ms
54,880 KB
testcase_22 AC 147 ms
56,776 KB
testcase_23 AC 146 ms
56,620 KB
testcase_24 AC 147 ms
56,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Yukicoder55 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] x = new int[4];
		int[] y = new int[4];
		int[][] pat = {{0, 1, 2}, {1, 0, 2}, {2, 0, 1}};

		for (int i = 0; i < 3; i++) {
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}
		for (int i = 0; i < 3; i++) {
			if (Math.hypot(x[pat[i][1]] - x[pat[i][0]], y[pat[i][1]] - y[pat[i][0]]) == Math.hypot(x[pat[i][2]] - x[pat[i][0]], y[pat[i][2]] - y[pat[i][0]])) {
				x[3] = x[pat[i][1]] + (x[pat[i][2]] - x[pat[i][0]]);
				y[3] = y[pat[i][1]] + (y[pat[i][2]] - y[pat[i][0]]);
				System.out.println(x[3] + " " + y[3]);
				return;
			}
		}
		System.out.println("-1");
	}
}
0