結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-21 16:17:06
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,169 bytes
コンパイル時間 3,565 ms
コンパイル使用メモリ 76,100 KB
実行使用メモリ 58,920 KB
最終ジャッジ日時 2023-08-18 06:09:48
合計ジャッジ時間 8,995 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
56,532 KB
testcase_01 WA -
testcase_02 AC 137 ms
56,932 KB
testcase_03 AC 141 ms
56,744 KB
testcase_04 AC 116 ms
56,808 KB
testcase_05 AC 114 ms
55,820 KB
testcase_06 AC 116 ms
55,992 KB
testcase_07 AC 117 ms
55,836 KB
testcase_08 AC 115 ms
55,888 KB
testcase_09 AC 117 ms
56,064 KB
testcase_10 WA -
testcase_11 AC 139 ms
56,500 KB
testcase_12 AC 118 ms
55,728 KB
testcase_13 AC 142 ms
56,836 KB
testcase_14 AC 141 ms
56,480 KB
testcase_15 AC 116 ms
56,104 KB
testcase_16 AC 144 ms
56,852 KB
testcase_17 AC 116 ms
56,152 KB
testcase_18 AC 144 ms
56,816 KB
testcase_19 AC 119 ms
56,288 KB
testcase_20 AC 142 ms
58,920 KB
testcase_21 AC 146 ms
57,132 KB
testcase_22 AC 140 ms
56,696 KB
testcase_23 AC 141 ms
56,812 KB
testcase_24 AC 140 ms
54,472 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