結果

問題 No.455 冬の大三角
ユーザー YamaKasaYamaKasa
提出日時 2018-09-22 15:03:25
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,217 bytes
コンパイル時間 1,915 ms
コンパイル使用メモリ 74,352 KB
実行使用メモリ 57,912 KB
最終ジャッジ日時 2023-09-25 11:03:57
合計ジャッジ時間 13,429 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
56,120 KB
testcase_01 AC 119 ms
54,220 KB
testcase_02 AC 157 ms
56,112 KB
testcase_03 AC 121 ms
55,828 KB
testcase_04 AC 121 ms
54,444 KB
testcase_05 AC 120 ms
55,896 KB
testcase_06 AC 120 ms
55,984 KB
testcase_07 AC 120 ms
55,872 KB
testcase_08 AC 261 ms
56,868 KB
testcase_09 AC 118 ms
55,668 KB
testcase_10 AC 119 ms
55,980 KB
testcase_11 AC 119 ms
53,972 KB
testcase_12 AC 119 ms
56,080 KB
testcase_13 AC 120 ms
56,268 KB
testcase_14 AC 120 ms
55,840 KB
testcase_15 AC 119 ms
55,968 KB
testcase_16 AC 119 ms
55,972 KB
testcase_17 AC 123 ms
55,732 KB
testcase_18 AC 119 ms
55,740 KB
testcase_19 AC 119 ms
55,912 KB
testcase_20 AC 120 ms
56,004 KB
testcase_21 AC 119 ms
54,208 KB
testcase_22 AC 118 ms
55,748 KB
testcase_23 AC 121 ms
56,052 KB
testcase_24 AC 120 ms
56,012 KB
testcase_25 AC 119 ms
55,880 KB
testcase_26 AC 122 ms
55,888 KB
testcase_27 AC 121 ms
55,724 KB
testcase_28 AC 120 ms
55,936 KB
testcase_29 AC 230 ms
56,808 KB
testcase_30 AC 190 ms
55,732 KB
testcase_31 AC 184 ms
56,372 KB
testcase_32 AC 187 ms
56,260 KB
testcase_33 AC 255 ms
56,356 KB
testcase_34 AC 142 ms
55,956 KB
testcase_35 AC 228 ms
56,356 KB
testcase_36 AC 189 ms
56,072 KB
testcase_37 AC 184 ms
54,528 KB
testcase_38 AC 170 ms
57,912 KB
testcase_39 AC 248 ms
56,816 KB
testcase_40 AC 207 ms
56,724 KB
testcase_41 AC 187 ms
56,208 KB
testcase_42 AC 184 ms
55,976 KB
testcase_43 AC 175 ms
55,988 KB
testcase_44 AC 163 ms
55,668 KB
testcase_45 AC 244 ms
56,260 KB
testcase_46 AC 186 ms
56,000 KB
testcase_47 AC 185 ms
56,124 KB
testcase_48 AC 186 ms
55,932 KB
testcase_49 AC 120 ms
55,708 KB
testcase_50 AC 124 ms
55,584 KB
testcase_51 AC 142 ms
56,068 KB
testcase_52 WA -
testcase_53 AC 158 ms
55,800 KB
testcase_54 AC 138 ms
55,640 KB
testcase_55 AC 171 ms
55,956 KB
testcase_56 AC 153 ms
56,240 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((r[0] - c[0]) == (r[1] - c[1]) && i - j == (r[0] - c[0])) {
					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