結果

問題 No.455 冬の大三角
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-12-06 04:16:28
言語 Java21
(openjdk 21)
結果
AC  
実行時間 190 ms / 2,000 ms
コード長 1,149 bytes
コンパイル時間 3,339 ms
コンパイル使用メモリ 76,216 KB
実行使用メモリ 59,172 KB
最終ジャッジ日時 2023-09-12 08:25:57
合計ジャッジ時間 14,837 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 154 ms
59,172 KB
testcase_01 AC 153 ms
56,444 KB
testcase_02 AC 156 ms
57,028 KB
testcase_03 AC 153 ms
56,844 KB
testcase_04 AC 153 ms
56,464 KB
testcase_05 AC 153 ms
56,988 KB
testcase_06 AC 152 ms
56,852 KB
testcase_07 AC 156 ms
56,536 KB
testcase_08 AC 189 ms
57,524 KB
testcase_09 AC 152 ms
56,888 KB
testcase_10 AC 152 ms
56,856 KB
testcase_11 AC 150 ms
56,828 KB
testcase_12 AC 151 ms
56,520 KB
testcase_13 AC 155 ms
54,908 KB
testcase_14 AC 151 ms
56,524 KB
testcase_15 AC 150 ms
56,844 KB
testcase_16 AC 149 ms
56,900 KB
testcase_17 AC 148 ms
56,836 KB
testcase_18 AC 151 ms
57,228 KB
testcase_19 AC 151 ms
57,040 KB
testcase_20 AC 152 ms
56,820 KB
testcase_21 AC 152 ms
56,912 KB
testcase_22 AC 153 ms
56,668 KB
testcase_23 AC 153 ms
58,984 KB
testcase_24 AC 152 ms
56,892 KB
testcase_25 AC 151 ms
56,884 KB
testcase_26 AC 151 ms
56,780 KB
testcase_27 AC 150 ms
56,644 KB
testcase_28 AC 153 ms
56,800 KB
testcase_29 AC 190 ms
57,304 KB
testcase_30 AC 172 ms
56,792 KB
testcase_31 AC 171 ms
56,896 KB
testcase_32 AC 169 ms
57,312 KB
testcase_33 AC 188 ms
55,856 KB
testcase_34 AC 163 ms
56,964 KB
testcase_35 AC 185 ms
57,488 KB
testcase_36 AC 167 ms
56,640 KB
testcase_37 AC 167 ms
57,256 KB
testcase_38 AC 165 ms
56,496 KB
testcase_39 AC 184 ms
57,244 KB
testcase_40 AC 180 ms
57,748 KB
testcase_41 AC 168 ms
57,236 KB
testcase_42 AC 165 ms
56,896 KB
testcase_43 AC 165 ms
57,084 KB
testcase_44 AC 160 ms
56,960 KB
testcase_45 AC 183 ms
57,444 KB
testcase_46 AC 165 ms
56,824 KB
testcase_47 AC 166 ms
56,768 KB
testcase_48 AC 164 ms
56,632 KB
testcase_49 AC 151 ms
57,108 KB
testcase_50 AC 152 ms
57,032 KB
testcase_51 AC 157 ms
56,492 KB
testcase_52 AC 163 ms
56,744 KB
testcase_53 AC 161 ms
56,944 KB
testcase_54 AC 154 ms
56,496 KB
testcase_55 AC 155 ms
56,776 KB
testcase_56 AC 170 ms
56,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        String [] S = new String [H];
        int [] x = new int [3];
        int [] y = new int [3];
        int n=0;
        for(int i=0; i<H; i++){
            S[i]=sc.next();
            for(int j=0; j<W; j++){
                if(S[i].charAt(j)=='*'){
                    x[n]=j;
                    y[n]=i;
                    n++;
                }
            }
        }
        while(true){
            int dx1 = x[1]-x[0];
            int dy1 = y[1]-y[0];
            int dx2 = x[2]-x[0];
            int dy2 = y[2]-y[0];
            int a = dx1*dx2+dy1*dy2;
            int b = dx1*dx1+dy1*dy1;
            int c = dx2*dx2+dy2*dy2;
            if(a*a!=b*c){
                break;
            }
            x[2]=(int)(Math.random()*W);
            y[2]=(int)(Math.random()*H);
        }
        S[y[2]]=S[y[2]].substring(0,x[2])+"*"+S[y[2]].substring(x[2]+1);
        for(int i=0; i<H; i++){
            System.out.println(S[i]);
        }
    }
}
0