結果

問題 No.82 市松模様
ユーザー GrenacheGrenache
提出日時 2015-09-23 00:54:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 571 bytes
コンパイル時間 3,382 ms
コンパイル使用メモリ 72,992 KB
実行使用メモリ 56,568 KB
最終ジャッジ日時 2023-09-26 14:33:23
合計ジャッジ時間 5,248 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,672 KB
testcase_01 AC 121 ms
56,220 KB
testcase_02 AC 120 ms
56,568 KB
testcase_03 AC 123 ms
56,284 KB
testcase_04 AC 125 ms
55,720 KB
testcase_05 AC 121 ms
55,764 KB
testcase_06 AC 121 ms
55,656 KB
testcase_07 AC 125 ms
55,748 KB
testcase_08 AC 127 ms
56,096 KB
testcase_09 AC 126 ms
55,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder82 {

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

        int w = sc.nextInt();
        int h = sc.nextInt();
        char[] bw = new char[2];
        bw[0] = sc.next().charAt(0);
        bw[1] = bw[0] == 'B' ? 'W' : 'B';
        for (int i = 0; i < h; i++) {
        	StringBuilder sb = new StringBuilder();
        	for (int j = 0; j < w; j++) {
        		sb.append(bw[(i + j) % 2]);
        	}
        	System.out.println(sb);
        }

        sc.close();
    }
}
0