結果

問題 No.455 冬の大三角
ユーザー tentententen
提出日時 2020-10-14 16:51:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 159 ms / 2,000 ms
コード長 1,112 bytes
コンパイル時間 2,306 ms
コンパイル使用メモリ 73,724 KB
実行使用メモリ 40,104 KB
最終ジャッジ日時 2023-09-28 00:40:03
合計ジャッジ時間 13,906 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
39,236 KB
testcase_01 AC 123 ms
39,324 KB
testcase_02 AC 125 ms
39,524 KB
testcase_03 AC 122 ms
39,164 KB
testcase_04 AC 120 ms
39,288 KB
testcase_05 AC 122 ms
39,104 KB
testcase_06 AC 125 ms
39,892 KB
testcase_07 AC 123 ms
39,164 KB
testcase_08 AC 155 ms
40,024 KB
testcase_09 AC 122 ms
39,372 KB
testcase_10 AC 123 ms
39,372 KB
testcase_11 AC 124 ms
39,072 KB
testcase_12 AC 126 ms
39,604 KB
testcase_13 AC 123 ms
39,360 KB
testcase_14 AC 124 ms
39,368 KB
testcase_15 AC 121 ms
39,148 KB
testcase_16 AC 120 ms
39,500 KB
testcase_17 AC 122 ms
39,804 KB
testcase_18 AC 122 ms
39,012 KB
testcase_19 AC 122 ms
39,320 KB
testcase_20 AC 123 ms
39,296 KB
testcase_21 AC 123 ms
39,012 KB
testcase_22 AC 122 ms
39,600 KB
testcase_23 AC 121 ms
39,336 KB
testcase_24 AC 120 ms
38,912 KB
testcase_25 AC 118 ms
39,080 KB
testcase_26 AC 122 ms
39,444 KB
testcase_27 AC 119 ms
39,380 KB
testcase_28 AC 117 ms
38,860 KB
testcase_29 AC 154 ms
40,068 KB
testcase_30 AC 134 ms
39,496 KB
testcase_31 AC 130 ms
38,972 KB
testcase_32 AC 132 ms
39,404 KB
testcase_33 AC 157 ms
39,800 KB
testcase_34 AC 128 ms
39,168 KB
testcase_35 AC 157 ms
40,016 KB
testcase_36 AC 134 ms
39,156 KB
testcase_37 AC 131 ms
39,640 KB
testcase_38 AC 130 ms
39,272 KB
testcase_39 AC 159 ms
40,104 KB
testcase_40 AC 152 ms
39,936 KB
testcase_41 AC 134 ms
39,212 KB
testcase_42 AC 133 ms
39,160 KB
testcase_43 AC 126 ms
39,112 KB
testcase_44 AC 127 ms
39,380 KB
testcase_45 AC 156 ms
39,728 KB
testcase_46 AC 132 ms
39,240 KB
testcase_47 AC 133 ms
39,464 KB
testcase_48 AC 129 ms
39,356 KB
testcase_49 AC 122 ms
38,956 KB
testcase_50 AC 123 ms
39,028 KB
testcase_51 AC 124 ms
39,344 KB
testcase_52 AC 128 ms
38,992 KB
testcase_53 AC 125 ms
39,284 KB
testcase_54 AC 123 ms
39,040 KB
testcase_55 AC 127 ms
39,428 KB
testcase_56 AC 128 ms
39,096 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();
    	char[][] field = new char[h][];
    	int idx = 0;
    	int[] arr = new int[2];
    	for (int i = 0; i < h; i++) {
    	    field[i] = sc.next().toCharArray();
    	    for (int j = 0; j < w; j++) {
    	        if (field[i][j] == '*')  {
    	            arr[idx] = i * w + j;
    	            idx++;
    	        }
    	    }
    	}
    	if (arr[0] % w == arr[1] % w) {
    	    if (arr[0] % w == 0) {
    	        field[(arr[0] + 1) / w][(arr[0] + 1) % w] = '*';
    	    } else {
    	        field[(arr[0] - 1) / w][(arr[0] - 1) % w] = '*';
    	    }
    	} else {
    	    if (arr[0] / w == 0) {
    	        field[(arr[0] + w) / w][(arr[0] + w) % w] = '*';
    	    } else {
    	        field[(arr[0] - w) / w][(arr[0] - w) % w] = '*';
    	    }
    	}
    	StringBuilder sb = new StringBuilder();
    	for (char[] tmp : field) {
    	    sb.append(new String(tmp)).append("\n");
    	}
    	System.out.print(sb);
	}
}
0