結果
問題 | No.82 市松模様 |
ユーザー | tenten |
提出日時 | 2020-11-10 15:32:37 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 128 ms / 5,000 ms |
コード長 | 631 bytes |
コンパイル時間 | 2,060 ms |
コンパイル使用メモリ | 72,428 KB |
実行使用メモリ | 56,180 KB |
最終ジャッジ日時 | 2023-09-29 23:37:18 |
合計ジャッジ時間 | 4,243 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 121 ms
56,032 KB |
testcase_01 | AC | 124 ms
55,448 KB |
testcase_02 | AC | 124 ms
55,916 KB |
testcase_03 | AC | 124 ms
55,992 KB |
testcase_04 | AC | 125 ms
55,716 KB |
testcase_05 | AC | 122 ms
56,180 KB |
testcase_06 | AC | 123 ms
55,864 KB |
testcase_07 | AC | 124 ms
56,096 KB |
testcase_08 | AC | 128 ms
55,836 KB |
testcase_09 | AC | 128 ms
55,716 KB |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int w = sc.nextInt(); int h = sc.nextInt(); char[] dis = new char[]{'B', 'W'}; int add; if (sc.next().charAt(0) == 'B') { add = 0; } else { add = 1; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { sb.append(dis[(i + j + add) % 2]); } sb.append("\n"); } System.out.print(sb); } }