結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー リチウムリチウム
提出日時 2014-11-03 02:35:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 161 ms / 5,000 ms
コード長 675 bytes
コンパイル時間 2,449 ms
コンパイル使用メモリ 79,108 KB
実行使用メモリ 42,624 KB
最終ジャッジ日時 2024-04-26 22:05:17
合計ジャッジ時間 6,983 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 160 ms
41,972 KB
testcase_01 AC 136 ms
41,256 KB
testcase_02 AC 156 ms
42,104 KB
testcase_03 AC 160 ms
42,484 KB
testcase_04 AC 124 ms
40,924 KB
testcase_05 AC 117 ms
39,724 KB
testcase_06 AC 133 ms
41,448 KB
testcase_07 AC 130 ms
41,072 KB
testcase_08 AC 134 ms
41,292 KB
testcase_09 AC 134 ms
41,592 KB
testcase_10 AC 136 ms
41,148 KB
testcase_11 AC 156 ms
42,292 KB
testcase_12 AC 118 ms
40,128 KB
testcase_13 AC 152 ms
42,024 KB
testcase_14 AC 159 ms
42,624 KB
testcase_15 AC 129 ms
41,340 KB
testcase_16 AC 161 ms
42,420 KB
testcase_17 AC 133 ms
41,300 KB
testcase_18 AC 157 ms
42,408 KB
testcase_19 AC 128 ms
41,364 KB
testcase_20 AC 142 ms
42,136 KB
testcase_21 AC 140 ms
41,980 KB
testcase_22 AC 156 ms
42,212 KB
testcase_23 AC 156 ms
42,344 KB
testcase_24 AC 154 ms
42,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		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();
		}
		for(int i=0;i<3;i++){
			int x1=x[i%3];
			int y1=y[i%3];
			int x2=x[(i+1)%3];
			int y2=y[(i+1)%3];
			int x3=x[(i+2)%3];
			int y3=y[(i+2)%3];
		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 ansx=x3+x1-x2;
				int ansy=y3+y1-y2;
				System.out.println(ansx+" "+ansy);
				return;
			}
		}
		
		
	}
		System.out.println(-1);}
}
0