結果

問題 No.82 市松模様
ユーザー dazydazy
提出日時 2016-09-09 17:23:41
言語 Java19
(openjdk 21)
結果
AC  
実行時間 180 ms / 5,000 ms
コード長 689 bytes
コンパイル時間 3,147 ms
コンパイル使用メモリ 71,996 KB
実行使用メモリ 56,180 KB
最終ジャッジ日時 2023-08-10 07:23:19
合計ジャッジ時間 5,481 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
56,112 KB
testcase_01 AC 122 ms
56,092 KB
testcase_02 AC 125 ms
56,056 KB
testcase_03 AC 120 ms
56,104 KB
testcase_04 AC 130 ms
56,180 KB
testcase_05 AC 129 ms
56,072 KB
testcase_06 AC 133 ms
55,904 KB
testcase_07 AC 150 ms
55,984 KB
testcase_08 AC 179 ms
56,032 KB
testcase_09 AC 180 ms
54,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        byte W = scan.nextByte();
        byte H = scan.nextByte();
        if (W < 1||W > 50||H < 1||H > 50) System.exit(1);
        String C = scan.next();

        boolean flag;
        if (C.equals("W")) flag = true;
        else flag = false;
        for (byte i = 0; i < H; i++){
            for (byte j = 0; j < W; j++) {
                if (flag) System.out.printf("W");
                else System.out.print("B");
                flag = !flag;
            }
            if (W%2==0) flag = !flag;
            System.out.println();
        }
    }
}
0