結果

問題 No.82 市松模様
ユーザー marumaru
提出日時 2016-03-23 00:02:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 186 ms / 5,000 ms
コード長 623 bytes
コンパイル時間 3,094 ms
コンパイル使用メモリ 74,672 KB
実行使用メモリ 54,332 KB
最終ジャッジ日時 2024-04-09 03:28:21
合計ジャッジ時間 5,231 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
53,740 KB
testcase_01 AC 129 ms
54,168 KB
testcase_02 AC 123 ms
54,020 KB
testcase_03 AC 116 ms
53,388 KB
testcase_04 AC 128 ms
54,156 KB
testcase_05 AC 128 ms
54,204 KB
testcase_06 AC 121 ms
53,060 KB
testcase_07 AC 143 ms
54,332 KB
testcase_08 AC 186 ms
54,248 KB
testcase_09 AC 170 ms
53,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class yukicoder_82 {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int w = stdIn.nextInt();
		int h = stdIn.nextInt();
		String c1 = stdIn.next();
		
		String c2 = (c1.equals("W")) ? "B" : "W";
		
		
		for (int i = 1; i <= h; i++) {
			for (int j = 1; j <= w; j++) {
				if (i % 2 == 1) {
					if (j % 2 == 1) {
						System.out.print(c1);
					} else {
						System.out.print(c2);
					}
				} else {
					if (j % 2 == 1) {
						System.out.print(c2);
					} else {
						System.out.print(c1);
					}
				}
			}
			System.out.println();
		}
	}
}
0