結果

問題 No.82 市松模様
ユーザー TatsuDXTatsuDX
提出日時 2016-09-08 23:44:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 182 ms / 5,000 ms
コード長 482 bytes
コンパイル時間 3,252 ms
コンパイル使用メモリ 72,040 KB
実行使用メモリ 56,156 KB
最終ジャッジ日時 2023-08-10 00:02:12
合計ジャッジ時間 5,158 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,432 KB
testcase_01 AC 122 ms
55,612 KB
testcase_02 AC 121 ms
55,748 KB
testcase_03 AC 121 ms
55,872 KB
testcase_04 AC 129 ms
55,892 KB
testcase_05 AC 125 ms
56,156 KB
testcase_06 AC 130 ms
55,508 KB
testcase_07 AC 144 ms
55,876 KB
testcase_08 AC 180 ms
56,088 KB
testcase_09 AC 182 ms
55,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt(), h = sc.nextInt();
		String s = sc.next(), a, b;
		if(s.charAt(0) == 'B'){
			a = "B";
			b = "W";
		} else {
			a = "W";
			b = "B";
		}
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				if((i+j)%2 == 0){
					System.out.print(a);
				} else {
					System.out.print(b);
				}
			}
			System.out.println();
		}
	}
}
0