結果

問題 No.82 市松模様
ユーザー jimanojimano
提出日時 2018-01-14 15:28:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 100 ms / 5,000 ms
コード長 827 bytes
コンパイル時間 3,325 ms
コンパイル使用メモリ 72,160 KB
実行使用メモリ 51,772 KB
最終ジャッジ日時 2023-08-25 17:21:13
合計ジャッジ時間 4,420 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,396 KB
testcase_01 AC 43 ms
49,456 KB
testcase_02 AC 43 ms
49,384 KB
testcase_03 AC 42 ms
49,440 KB
testcase_04 AC 47 ms
49,484 KB
testcase_05 AC 43 ms
49,656 KB
testcase_06 AC 49 ms
49,516 KB
testcase_07 AC 56 ms
49,560 KB
testcase_08 AC 96 ms
51,772 KB
testcase_09 AC 100 ms
51,660 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 ichimatsu1 = str[2].charAt(0);
			char ichimatsu2 = (ichimatsu1 == 'W') ? 'B' : 'W';

			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					if (i % 2 == 0 && j % 2 == 0 || i % 2 == 1 && j % 2 == 1) {
						System.out.print(ichimatsu1);
					} else {
						System.out.print(ichimatsu2);
					}
				}
				System.out.println();
			}

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