結果
問題 | No.82 市松模様 |
ユーザー |
|
提出日時 | 2015-05-23 23:40:09 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 192 ms / 5,000 ms |
コード長 | 715 bytes |
コンパイル時間 | 3,529 ms |
コンパイル使用メモリ | 76,776 KB |
実行使用メモリ | 41,784 KB |
最終ジャッジ日時 | 2024-07-06 06:23:22 |
合計ジャッジ時間 | 5,404 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
import java.util.*;public class Ichimatsu{public static void main(String[] arg){Scanner sc = new Scanner(System.in);int w,h;char b;w = sc.nextInt();h = sc.nextInt();b = sc.next().charAt(0);if(b == 'B'){for(int i = 0;i<h;i++){for(int j = 0;j<w;j++){if(((j%2 == 0) && (i%2 == 0))||((j%2 == 1)&&(i%2 == 1))){System.out.print("B");}else{System.out.print("W");}}System.out.println("");}}else{for(int i = 0;i<h;i++){for(int j = 0;j<w;j++){if(((j%2 == 0) && (i%2 == 0))||((j%2 == 1)&&(i%2 == 1))){System.out.print("W");}else{System.out.print("B");}}System.out.println("");}}}}