結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー scachescache
提出日時 2014-11-26 20:17:20
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,040 bytes
コンパイル時間 3,719 ms
コンパイル使用メモリ 79,248 KB
実行使用メモリ 42,544 KB
最終ジャッジ日時 2024-04-16 22:19:17
合計ジャッジ時間 8,164 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 156 ms
42,308 KB
testcase_01 AC 128 ms
41,120 KB
testcase_02 AC 155 ms
42,328 KB
testcase_03 AC 153 ms
42,244 KB
testcase_04 WA -
testcase_05 AC 134 ms
41,376 KB
testcase_06 AC 131 ms
41,368 KB
testcase_07 AC 133 ms
41,552 KB
testcase_08 AC 132 ms
41,152 KB
testcase_09 AC 127 ms
41,172 KB
testcase_10 AC 128 ms
41,412 KB
testcase_11 AC 141 ms
42,212 KB
testcase_12 AC 129 ms
41,384 KB
testcase_13 AC 153 ms
42,264 KB
testcase_14 AC 156 ms
42,416 KB
testcase_15 AC 127 ms
41,220 KB
testcase_16 AC 153 ms
42,304 KB
testcase_17 AC 118 ms
40,060 KB
testcase_18 AC 155 ms
42,544 KB
testcase_19 AC 117 ms
40,072 KB
testcase_20 AC 157 ms
42,232 KB
testcase_21 AC 153 ms
42,256 KB
testcase_22 AC 152 ms
42,144 KB
testcase_23 AC 156 ms
42,512 KB
testcase_24 AC 155 ms
42,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main55 {
	public static void main(String[] args) {
		Main55 p = new Main55();
	}

	public Main55() {
		Scanner sc = new Scanner(System.in);
		int[] x = new int[3];
		int[] y = new int[3];
		for(int i=0;i<3;i++){
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}
		solve(x, y);
	}

	public void solve(int[] x, int[] y) {
		String res = "";
		
		if((res = isOk(x[0], y[0], x[1], y[1], x[2], y[2])) != null)
			System.out.println(res);
		else if((res = isOk(x[2], y[2], x[0], y[0], x[1], y[1])) != null)
			System.out.println(res);
		else if((res = isOk(x[1], y[1], x[2], y[2], x[0], y[0])) != null)
			System.out.println(res);
		else
			System.out.println("-1");
	}

	private String isOk(int x1, int y1, int x2, int y2, int x3, int y3){
		int vx1 = x1-x2;
		int vx2 = x3-x2;
		int vy1 = y1-y2;
		int vy2 = y3-y2;
		if(vx1*vy1+vx2*vy2==0 && (vx1*vx1+vy1*vy1) == (vx2*vx2+vy2*vy2))
			return (x2+vx1+vx2) + " " + (y2+vy1+vy2);
		else
			return null;
	}
	
}
0