結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-21 16:17:06
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,169 bytes
コンパイル時間 2,014 ms
コンパイル使用メモリ 79,000 KB
実行使用メモリ 42,556 KB
最終ジャッジ日時 2024-05-05 12:15:06
合計ジャッジ時間 6,149 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
42,096 KB
testcase_01 WA -
testcase_02 AC 134 ms
42,240 KB
testcase_03 AC 134 ms
42,156 KB
testcase_04 AC 115 ms
41,000 KB
testcase_05 AC 105 ms
39,584 KB
testcase_06 AC 116 ms
40,920 KB
testcase_07 AC 108 ms
40,028 KB
testcase_08 AC 114 ms
41,000 KB
testcase_09 AC 116 ms
41,028 KB
testcase_10 WA -
testcase_11 AC 121 ms
41,648 KB
testcase_12 AC 100 ms
40,360 KB
testcase_13 AC 124 ms
41,932 KB
testcase_14 AC 135 ms
42,232 KB
testcase_15 AC 112 ms
41,336 KB
testcase_16 AC 130 ms
41,832 KB
testcase_17 AC 114 ms
41,216 KB
testcase_18 AC 138 ms
42,556 KB
testcase_19 AC 114 ms
41,124 KB
testcase_20 AC 137 ms
42,268 KB
testcase_21 AC 139 ms
42,112 KB
testcase_22 AC 140 ms
42,532 KB
testcase_23 AC 138 ms
42,320 KB
testcase_24 AC 138 ms
42,536 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();
        }
        int c=check(x,y,0);
        if(c==-1){
            System.out.println(-1);
        }else{
            int x4=point(x,c);
            int y4=point(y,c);
            System.out.println(x4+" "+y4);
        }
    }
    static int check(int[]x, int[]y,int z){
        if(z==3){
            return -1;
        }
        int ax = x[z%3]-x[(z+1)%3];
        int bx = x[(z+2)%3]-x[(z+1)%3];
        int cx = x[z%3]-x[(z+2)%3];
        int ay = y[z%3]-y[(z+1)%3];
        int by = y[(z+2)%3]-y[(z+1)%3];
        int cy = y[z%3]-y[(z+2)%3];
        int d1 = ax*ax+ay*ay;
        int d2 = bx*bx+by*by;
        int d3 = cx*cx+cy*cy;
        if(d1+d2==d3){
            return z;
        }else{
            return check(x,y,z+1);
        }
    }
    static int point(int[]A,int B){
        int n = A[(B+2)%3]-A[(B+1)%3];
        int r = A[B%3]+n;
        return r;
    }
}
0