結果

問題 No.82 市松模様
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-20 18:29:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 191 ms / 5,000 ms
コード長 400 bytes
コンパイル時間 2,082 ms
コンパイル使用メモリ 74,500 KB
実行使用メモリ 54,604 KB
最終ジャッジ日時 2024-05-01 07:58:00
合計ジャッジ時間 4,188 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
53,932 KB
testcase_01 AC 116 ms
52,908 KB
testcase_02 AC 114 ms
52,936 KB
testcase_03 AC 129 ms
54,348 KB
testcase_04 AC 137 ms
54,184 KB
testcase_05 AC 134 ms
54,016 KB
testcase_06 AC 138 ms
54,276 KB
testcase_07 AC 149 ms
54,356 KB
testcase_08 AC 176 ms
54,428 KB
testcase_09 AC 191 ms
54,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int h = sc.nextInt();
		char c =sc.next().charAt(0);
		int k = c == 'B' ? 0 : 1;
		for(int i = 0 ; i < h ; i++) {
			for(int j = 0 ; j < w ; j++) {
				System.out.print((i + j + k) % 2 == 0 ? "B" : "W");
			}
			System.out.println();
		}
 	}
}

0