結果
問題 | No.82 市松模様 |
ユーザー | yagi2 |
提出日時 | 2017-04-25 14:27:26 |
言語 | Java19 (openjdk 21) |
結果 |
AC
|
実行時間 | 172 ms / 5,000 ms |
コード長 | 886 bytes |
コンパイル時間 | 3,148 ms |
コンパイル使用メモリ | 72,296 KB |
実行使用メモリ | 56,160 KB |
最終ジャッジ日時 | 2023-10-11 09:34:06 |
合計ジャッジ時間 | 3,643 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 105 ms
55,872 KB |
testcase_01 | AC | 103 ms
56,052 KB |
testcase_02 | AC | 103 ms
55,784 KB |
testcase_03 | AC | 105 ms
56,032 KB |
testcase_04 | AC | 109 ms
55,804 KB |
testcase_05 | AC | 107 ms
55,720 KB |
testcase_06 | AC | 110 ms
55,840 KB |
testcase_07 | AC | 132 ms
56,004 KB |
testcase_08 | AC | 168 ms
55,948 KB |
testcase_09 | AC | 172 ms
56,160 KB |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int W = Integer.parseInt(sc.next()); int H = Integer.parseInt(sc.next()); String S = sc.next(); String N = "W".equals(S)? "B" : "W"; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { if (i % 2 == 0) { if (j % 2 == 0) { System.out.print(S); } else { System.out.print(N); } } else { if (j % 2 == 0) { System.out.print(N); } else { System.out.print(S); } } } System.out.println(); } } }