結果

問題 No.82 市松模様
ユーザー dazydazy
提出日時 2016-09-09 17:23:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 170 ms / 5,000 ms
コード長 689 bytes
コンパイル時間 2,870 ms
コンパイル使用メモリ 75,008 KB
実行使用メモリ 54,588 KB
最終ジャッジ日時 2024-04-28 00:59:40
合計ジャッジ時間 4,847 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
54,052 KB
testcase_01 AC 114 ms
53,908 KB
testcase_02 AC 99 ms
52,652 KB
testcase_03 AC 102 ms
53,100 KB
testcase_04 AC 115 ms
53,332 KB
testcase_05 AC 107 ms
53,108 KB
testcase_06 AC 113 ms
53,208 KB
testcase_07 AC 149 ms
54,040 KB
testcase_08 AC 170 ms
54,588 KB
testcase_09 AC 167 ms
54,480 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