結果

問題 No.455 冬の大三角
ユーザー YamaKasaYamaKasa
提出日時 2018-09-22 15:20:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 263 ms / 2,000 ms
コード長 1,015 bytes
コンパイル時間 1,964 ms
コンパイル使用メモリ 74,368 KB
実行使用メモリ 58,708 KB
最終ジャッジ日時 2023-09-25 11:04:59
合計ジャッジ時間 13,891 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,760 KB
testcase_01 AC 123 ms
56,112 KB
testcase_02 AC 147 ms
55,760 KB
testcase_03 AC 126 ms
55,808 KB
testcase_04 AC 124 ms
55,944 KB
testcase_05 AC 122 ms
55,680 KB
testcase_06 AC 121 ms
55,756 KB
testcase_07 AC 128 ms
55,856 KB
testcase_08 AC 263 ms
58,708 KB
testcase_09 AC 124 ms
56,080 KB
testcase_10 AC 120 ms
55,616 KB
testcase_11 AC 120 ms
55,876 KB
testcase_12 AC 122 ms
55,992 KB
testcase_13 AC 121 ms
55,908 KB
testcase_14 AC 123 ms
55,680 KB
testcase_15 AC 122 ms
55,620 KB
testcase_16 AC 122 ms
55,988 KB
testcase_17 AC 121 ms
55,776 KB
testcase_18 AC 123 ms
55,776 KB
testcase_19 AC 119 ms
55,576 KB
testcase_20 AC 121 ms
55,780 KB
testcase_21 AC 119 ms
55,984 KB
testcase_22 AC 124 ms
56,224 KB
testcase_23 AC 122 ms
53,756 KB
testcase_24 AC 121 ms
55,672 KB
testcase_25 AC 123 ms
55,840 KB
testcase_26 AC 123 ms
55,712 KB
testcase_27 AC 122 ms
56,124 KB
testcase_28 AC 125 ms
55,768 KB
testcase_29 AC 237 ms
56,768 KB
testcase_30 AC 188 ms
56,004 KB
testcase_31 AC 186 ms
55,980 KB
testcase_32 AC 195 ms
55,588 KB
testcase_33 AC 259 ms
56,820 KB
testcase_34 AC 150 ms
56,012 KB
testcase_35 AC 241 ms
56,568 KB
testcase_36 AC 189 ms
56,404 KB
testcase_37 AC 176 ms
55,992 KB
testcase_38 AC 177 ms
55,800 KB
testcase_39 AC 247 ms
56,448 KB
testcase_40 AC 212 ms
56,320 KB
testcase_41 AC 194 ms
55,972 KB
testcase_42 AC 183 ms
55,576 KB
testcase_43 AC 179 ms
55,732 KB
testcase_44 AC 176 ms
56,428 KB
testcase_45 AC 234 ms
56,936 KB
testcase_46 AC 188 ms
56,024 KB
testcase_47 AC 187 ms
55,964 KB
testcase_48 AC 187 ms
55,844 KB
testcase_49 AC 125 ms
55,932 KB
testcase_50 AC 127 ms
55,908 KB
testcase_51 AC 146 ms
55,844 KB
testcase_52 AC 150 ms
56,040 KB
testcase_53 AC 170 ms
56,344 KB
testcase_54 AC 145 ms
55,724 KB
testcase_55 AC 178 ms
55,744 KB
testcase_56 AC 147 ms
55,880 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;
				if(p[0] * vx == p[1] * vy) {
					continue;
				}else {
					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