結果

問題 No.455 冬の大三角
ユーザー Mcpu3Mcpu3
提出日時 2018-09-27 21:00:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 179 ms / 2,000 ms
コード長 902 bytes
コンパイル時間 2,129 ms
コンパイル使用メモリ 77,072 KB
実行使用メモリ 41,760 KB
最終ジャッジ日時 2024-04-20 09:10:57
合計ジャッジ時間 12,612 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
40,284 KB
testcase_01 AC 123 ms
39,944 KB
testcase_02 AC 126 ms
40,252 KB
testcase_03 AC 140 ms
41,220 KB
testcase_04 AC 137 ms
41,220 KB
testcase_05 AC 136 ms
41,204 KB
testcase_06 AC 133 ms
41,208 KB
testcase_07 AC 139 ms
41,224 KB
testcase_08 AC 177 ms
41,636 KB
testcase_09 AC 136 ms
41,196 KB
testcase_10 AC 137 ms
40,928 KB
testcase_11 AC 136 ms
41,096 KB
testcase_12 AC 138 ms
41,336 KB
testcase_13 AC 134 ms
41,228 KB
testcase_14 AC 135 ms
41,436 KB
testcase_15 AC 134 ms
41,056 KB
testcase_16 AC 136 ms
41,372 KB
testcase_17 AC 132 ms
41,016 KB
testcase_18 AC 134 ms
40,876 KB
testcase_19 AC 137 ms
41,328 KB
testcase_20 AC 134 ms
41,508 KB
testcase_21 AC 136 ms
40,992 KB
testcase_22 AC 136 ms
41,356 KB
testcase_23 AC 134 ms
41,524 KB
testcase_24 AC 139 ms
41,440 KB
testcase_25 AC 140 ms
41,196 KB
testcase_26 AC 139 ms
41,364 KB
testcase_27 AC 138 ms
41,340 KB
testcase_28 AC 136 ms
41,092 KB
testcase_29 AC 177 ms
41,760 KB
testcase_30 AC 153 ms
41,432 KB
testcase_31 AC 154 ms
41,356 KB
testcase_32 AC 151 ms
41,372 KB
testcase_33 AC 179 ms
41,696 KB
testcase_34 AC 147 ms
41,204 KB
testcase_35 AC 157 ms
41,704 KB
testcase_36 AC 151 ms
41,472 KB
testcase_37 AC 153 ms
41,564 KB
testcase_38 AC 134 ms
40,036 KB
testcase_39 AC 177 ms
41,596 KB
testcase_40 AC 151 ms
41,060 KB
testcase_41 AC 157 ms
41,416 KB
testcase_42 AC 152 ms
41,320 KB
testcase_43 AC 150 ms
41,360 KB
testcase_44 AC 146 ms
41,216 KB
testcase_45 AC 171 ms
41,692 KB
testcase_46 AC 148 ms
41,352 KB
testcase_47 AC 153 ms
41,700 KB
testcase_48 AC 142 ms
41,348 KB
testcase_49 AC 133 ms
41,424 KB
testcase_50 AC 136 ms
41,112 KB
testcase_51 AC 141 ms
41,252 KB
testcase_52 AC 144 ms
41,332 KB
testcase_53 AC 143 ms
41,532 KB
testcase_54 AC 125 ms
39,944 KB
testcase_55 AC 140 ms
41,160 KB
testcase_56 AC 146 ms
41,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt(), W = sc.nextInt(), h[] = new int[2], w[] = new int[2], k = 0;
        char S[][] = new char[H][W + 1];
        for (int i = 0; i < H; ++i) {
            S[i] = sc.next().toCharArray();
            for (int j = 0; j < W && k != 2; ++j) {
                if (S[i][j] == '*') {
                    h[k] = i;
                    w[k] = j;
                    ++k;
                }
            }
        }
        sc.close();
        if (h[0] == h[1]) {
            if (h[0] == 0) S[1][0] = '*';
            else S[0][0] = '*';
        }
        else {
            if (w[0] == 0) S[h[0]][1] = '*';
            else S[h[0]][w[0] - 1] = '*';
        }
        for (int i = 0; i < H; ++i) System.out.println(S[i]);
    }
}
0