結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー kou6839kou6839
提出日時 2014-11-24 15:34:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 167 ms / 5,000 ms
コード長 804 bytes
コンパイル時間 2,584 ms
コンパイル使用メモリ 79,684 KB
実行使用メモリ 42,608 KB
最終ジャッジ日時 2024-04-26 22:10:04
合計ジャッジ時間 7,286 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 166 ms
42,596 KB
testcase_01 AC 142 ms
41,424 KB
testcase_02 AC 159 ms
42,092 KB
testcase_03 AC 167 ms
42,536 KB
testcase_04 AC 134 ms
41,296 KB
testcase_05 AC 142 ms
41,436 KB
testcase_06 AC 133 ms
41,240 KB
testcase_07 AC 135 ms
41,108 KB
testcase_08 AC 135 ms
41,496 KB
testcase_09 AC 139 ms
41,360 KB
testcase_10 AC 132 ms
41,168 KB
testcase_11 AC 154 ms
42,376 KB
testcase_12 AC 131 ms
41,080 KB
testcase_13 AC 158 ms
42,068 KB
testcase_14 AC 154 ms
42,332 KB
testcase_15 AC 130 ms
41,496 KB
testcase_16 AC 159 ms
42,180 KB
testcase_17 AC 126 ms
40,992 KB
testcase_18 AC 154 ms
42,608 KB
testcase_19 AC 140 ms
41,272 KB
testcase_20 AC 159 ms
42,244 KB
testcase_21 AC 161 ms
42,196 KB
testcase_22 AC 165 ms
42,400 KB
testcase_23 AC 158 ms
42,164 KB
testcase_24 AC 163 ms
42,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;
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++){
        	if( Math.pow(x[i]-x[(i+1)%3],2)+Math.pow(y[i]-y[(i+1)%3],2) ==Math.pow(x[i]-x[(i+2)%3],2)+Math.pow(y[i]-y[(i+2)%3],2) &&  Math.pow(x[i]-x[(i+1)%3],2)*2+Math.pow(y[i]-y[(i+1)%3],2)*2==Math.pow(x[(i+1)%3]-x[(i+2)%3],2)+Math.pow(y[(i+1)%3]-y[(i+2)%3],2)){
        		System.out.println( (x[(i+1)%3]-x[i]+x[(i+2)%3])+" "+(y[(i+1)%3]-y[i]+y[(i+2)%3]) );
        		return;
        	}
        }
        System.out.println(-1);
    }
}
0