結果

問題 No.455 冬の大三角
ユーザー YamaKasaYamaKasa
提出日時 2018-09-22 14:58:27
言語 Java19
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,110 bytes
コンパイル時間 1,987 ms
コンパイル使用メモリ 74,172 KB
実行使用メモリ 58,556 KB
最終ジャッジ日時 2023-09-25 11:03:30
合計ジャッジ時間 13,952 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,612 KB
testcase_01 AC 124 ms
56,376 KB
testcase_02 AC 159 ms
55,896 KB
testcase_03 AC 123 ms
55,768 KB
testcase_04 AC 125 ms
56,360 KB
testcase_05 WA -
testcase_06 AC 120 ms
55,736 KB
testcase_07 AC 120 ms
55,612 KB
testcase_08 AC 260 ms
58,556 KB
testcase_09 AC 121 ms
56,292 KB
testcase_10 AC 121 ms
56,032 KB
testcase_11 AC 121 ms
56,580 KB
testcase_12 AC 122 ms
55,852 KB
testcase_13 AC 121 ms
55,764 KB
testcase_14 AC 120 ms
55,744 KB
testcase_15 AC 123 ms
55,864 KB
testcase_16 AC 126 ms
54,388 KB
testcase_17 AC 123 ms
55,896 KB
testcase_18 AC 125 ms
55,780 KB
testcase_19 AC 120 ms
55,696 KB
testcase_20 AC 121 ms
56,068 KB
testcase_21 AC 119 ms
56,200 KB
testcase_22 AC 120 ms
56,048 KB
testcase_23 AC 122 ms
55,940 KB
testcase_24 AC 122 ms
56,308 KB
testcase_25 AC 122 ms
56,120 KB
testcase_26 AC 123 ms
55,888 KB
testcase_27 AC 123 ms
55,612 KB
testcase_28 AC 124 ms
55,544 KB
testcase_29 AC 248 ms
56,704 KB
testcase_30 AC 191 ms
56,388 KB
testcase_31 AC 184 ms
55,856 KB
testcase_32 AC 183 ms
55,796 KB
testcase_33 AC 257 ms
56,456 KB
testcase_34 AC 143 ms
56,000 KB
testcase_35 AC 223 ms
56,444 KB
testcase_36 AC 185 ms
55,720 KB
testcase_37 AC 176 ms
56,536 KB
testcase_38 AC 182 ms
55,660 KB
testcase_39 AC 251 ms
57,228 KB
testcase_40 AC 207 ms
56,680 KB
testcase_41 AC 187 ms
56,636 KB
testcase_42 AC 185 ms
54,384 KB
testcase_43 AC 165 ms
56,064 KB
testcase_44 AC 172 ms
54,152 KB
testcase_45 AC 245 ms
56,892 KB
testcase_46 AC 189 ms
56,416 KB
testcase_47 AC 189 ms
56,524 KB
testcase_48 AC 190 ms
56,080 KB
testcase_49 AC 123 ms
55,932 KB
testcase_50 AC 126 ms
55,992 KB
testcase_51 AC 142 ms
56,116 KB
testcase_52 WA -
testcase_53 AC 167 ms
56,348 KB
testcase_54 AC 143 ms
56,604 KB
testcase_55 AC 167 ms
56,052 KB
testcase_56 AC 146 ms
56,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int H = scan.nextInt();
		int W = scan.nextInt();
		int[]r = new int[3];
		int[]c = new int[3];
		int idx = 0;
		char [][]s = new char[H][W];
		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				s[i][j] = '-';
			}
		}
		for(int i = 0; i < H; i++) {
			String t = scan.next();
			for(int j = 0; j < W; j++) {
				char ch = t.charAt(j);
				if(ch == '*') {
					r[idx] = i;
					c[idx] = j;
					s[i][j] = '*';
					idx++;
				}
			}
		}
		loop: for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				boolean flag = true;
				if(r[0] == i && c[0] == j || r[1] == i && c[2] == j) {
					flag = false;
					continue;
				}
				if(r[0] == i && r[1] == i || c[0] == c[1] && c[0] == j) {
					flag = false;
					continue;
				}
				if(flag) {
					r[2] = i;
					c[2] = j;
					break loop;
				}
			}
		}
		s[r[2]][c[2]] = '*';
		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				System.out.print(s[i][j]);
			}
			System.out.println();
		}
	}
}
0