結果

問題 No.82 市松模様
ユーザー jimanojimano
提出日時 2018-01-14 15:22:11
言語 Java19
(openjdk 21)
結果
AC  
実行時間 98 ms / 5,000 ms
コード長 998 bytes
コンパイル時間 2,815 ms
コンパイル使用メモリ 74,160 KB
実行使用メモリ 51,768 KB
最終ジャッジ日時 2023-08-25 17:20:46
合計ジャッジ時間 4,096 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
49,324 KB
testcase_01 AC 38 ms
49,572 KB
testcase_02 AC 35 ms
49,260 KB
testcase_03 AC 36 ms
49,384 KB
testcase_04 AC 40 ms
49,312 KB
testcase_05 AC 39 ms
49,512 KB
testcase_06 AC 44 ms
49,332 KB
testcase_07 AC 49 ms
49,248 KB
testcase_08 AC 97 ms
51,768 KB
testcase_09 AC 98 ms
51,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder.lv1;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class No0082 {
	public static void main(String[] args) {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			String[] str = br.readLine().split(" ");
			int W = Integer.parseInt(str[0]);
			int H = Integer.parseInt(str[1]);

			char[] ichimatsu = new char[2];
			ichimatsu[0] = str[2].charAt(0);
			if (ichimatsu[0] == 'W')
				ichimatsu[1] = 'B';
			else
				ichimatsu[1] = 'W';

			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					if (i % 2 == 0) {
						if (j % 2 == 0)
							System.out.print(ichimatsu[0]);
						else
							System.out.print(ichimatsu[1]);
					} else {
						if (j % 2 == 0)
							System.out.print(ichimatsu[1]);
						else
							System.out.print(ichimatsu[0]);
					}
				}
				System.out.println();
			}

		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0