結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,664 KB
testcase_01 WA -
testcase_02 AC 148 ms
55,900 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 121 ms
55,892 KB
testcase_07 AC 121 ms
56,076 KB
testcase_08 AC 269 ms
59,076 KB
testcase_09 WA -
testcase_10 AC 121 ms
55,732 KB
testcase_11 AC 123 ms
55,704 KB
testcase_12 AC 120 ms
55,608 KB
testcase_13 WA -
testcase_14 AC 122 ms
55,704 KB
testcase_15 WA -
testcase_16 AC 122 ms
55,492 KB
testcase_17 AC 121 ms
55,780 KB
testcase_18 AC 122 ms
55,680 KB
testcase_19 WA -
testcase_20 AC 120 ms
56,136 KB
testcase_21 WA -
testcase_22 AC 129 ms
55,532 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 RE -
testcase_26 AC 130 ms
54,144 KB
testcase_27 AC 121 ms
53,812 KB
testcase_28 AC 124 ms
55,920 KB
testcase_29 AC 249 ms
56,600 KB
testcase_30 AC 192 ms
56,104 KB
testcase_31 AC 189 ms
55,772 KB
testcase_32 AC 196 ms
55,944 KB
testcase_33 AC 259 ms
57,228 KB
testcase_34 AC 147 ms
55,616 KB
testcase_35 AC 226 ms
56,372 KB
testcase_36 AC 188 ms
55,716 KB
testcase_37 AC 189 ms
54,204 KB
testcase_38 AC 185 ms
56,040 KB
testcase_39 AC 249 ms
56,928 KB
testcase_40 AC 210 ms
56,200 KB
testcase_41 AC 190 ms
56,288 KB
testcase_42 AC 184 ms
55,964 KB
testcase_43 AC 178 ms
55,960 KB
testcase_44 AC 179 ms
55,844 KB
testcase_45 AC 242 ms
56,548 KB
testcase_46 AC 188 ms
56,060 KB
testcase_47 AC 191 ms
56,288 KB
testcase_48 AC 192 ms
56,232 KB
testcase_49 AC 126 ms
55,452 KB
testcase_50 AC 128 ms
55,672 KB
testcase_51 AC 145 ms
55,928 KB
testcase_52 WA -
testcase_53 AC 170 ms
55,856 KB
testcase_54 AC 143 ms
55,608 KB
testcase_55 AC 168 ms
56,088 KB
testcase_56 AC 149 ms
56,044 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++;
				}
			}
		}
		int[]p = {r[0] - r[1], c[0] - c[1]};

		loop: for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				int vy = r[0] - i;
				int vx = c[0] - j;
				int t = p[0] * vy + p[1] * vx;
				if(t == 0 || t == -1) {
					continue;
				}else {
					r[2] = i;
					c[2] = i;
					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