結果
問題 | No.82 市松模様 |
ユーザー |
![]() |
提出日時 | 2016-09-08 23:44:59 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 185 ms / 5,000 ms |
コード長 | 482 bytes |
コンパイル時間 | 3,184 ms |
コンパイル使用メモリ | 75,448 KB |
実行使用メモリ | 41,988 KB |
最終ジャッジ日時 | 2024-11-15 22:29:10 |
合計ジャッジ時間 | 5,213 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int w = sc.nextInt(), h = sc.nextInt(); String s = sc.next(), a, b; if(s.charAt(0) == 'B'){ a = "B"; b = "W"; } else { a = "W"; b = "B"; } for(int i = 0; i < h; i++){ for(int j = 0; j < w; j++){ if((i+j)%2 == 0){ System.out.print(a); } else { System.out.print(b); } } System.out.println(); } } }