結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー rn4rurn4ru
提出日時 2016-04-14 08:31:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 167 ms / 5,000 ms
コード長 831 bytes
コンパイル時間 2,376 ms
コンパイル使用メモリ 79,592 KB
実行使用メモリ 42,520 KB
最終ジャッジ日時 2024-04-26 22:19:49
合計ジャッジ時間 6,960 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 163 ms
42,320 KB
testcase_01 AC 135 ms
41,420 KB
testcase_02 AC 158 ms
42,248 KB
testcase_03 AC 158 ms
42,224 KB
testcase_04 AC 134 ms
41,468 KB
testcase_05 AC 138 ms
41,212 KB
testcase_06 AC 135 ms
41,328 KB
testcase_07 AC 133 ms
41,612 KB
testcase_08 AC 129 ms
41,000 KB
testcase_09 AC 117 ms
40,172 KB
testcase_10 AC 133 ms
41,292 KB
testcase_11 AC 160 ms
42,296 KB
testcase_12 AC 118 ms
39,800 KB
testcase_13 AC 165 ms
42,104 KB
testcase_14 AC 159 ms
42,520 KB
testcase_15 AC 138 ms
41,936 KB
testcase_16 AC 167 ms
42,480 KB
testcase_17 AC 136 ms
41,248 KB
testcase_18 AC 159 ms
42,136 KB
testcase_19 AC 137 ms
41,208 KB
testcase_20 AC 159 ms
42,132 KB
testcase_21 AC 160 ms
42,260 KB
testcase_22 AC 157 ms
41,976 KB
testcase_23 AC 157 ms
42,120 KB
testcase_24 AC 158 ms
42,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int x1, y1, x2, y2, x3, y3;
		x1 = scanner.nextInt();
		y1 = scanner.nextInt();
		x2 = scanner.nextInt();
		y2 = scanner.nextInt();
		x3 = scanner.nextInt();
		y3 = scanner.nextInt();

		if (f(x1, y1, x2, y2, x3, y3) || f(x1, y1, x3, y3, x2, y2) || f(x2, y2, x1, y1, x3, y3)
				|| f(x2, y2, x3, y3, x1, y1) || f(x3, y3, x2, y2, x1, y1) || f(x3, y3, x1, y1, x2, y2)) {

		} else {
			System.out.println(-1);
		}

	}

	private static boolean f(int x1, int y1, int x2, int y2, int x3, int y3) {
		int dx = x2 - x1;
		int dy = y2 - y1;
		if (y3 == y2 + dx && x3 == x2 - dy) {
			int x4 = x3 - dx;
			int y4 = y3 - dy;
			System.out.println(x4 + " " + y4);
			return true;
		}
		return false;
	}

}
0