結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 154 ms
42,092 KB
testcase_01 AC 133 ms
41,508 KB
testcase_02 AC 161 ms
42,212 KB
testcase_03 AC 154 ms
42,484 KB
testcase_04 AC 119 ms
40,320 KB
testcase_05 AC 131 ms
41,248 KB
testcase_06 AC 135 ms
41,496 KB
testcase_07 AC 131 ms
41,276 KB
testcase_08 AC 135 ms
41,232 KB
testcase_09 AC 131 ms
41,752 KB
testcase_10 AC 116 ms
40,228 KB
testcase_11 AC 142 ms
42,076 KB
testcase_12 AC 133 ms
41,200 KB
testcase_13 AC 152 ms
42,376 KB
testcase_14 AC 156 ms
42,512 KB
testcase_15 AC 131 ms
41,340 KB
testcase_16 AC 155 ms
42,552 KB
testcase_17 AC 131 ms
41,204 KB
testcase_18 AC 164 ms
42,452 KB
testcase_19 AC 135 ms
41,460 KB
testcase_20 AC 159 ms
42,316 KB
testcase_21 AC 160 ms
42,192 KB
testcase_22 AC 160 ms
42,352 KB
testcase_23 AC 157 ms
42,400 KB
testcase_24 AC 156 ms
42,240 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(Math.hypot(x1-x2,y1-y2)==Math.hypot(x2-x3,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