結果
問題 | No.82 市松模様 |
ユーザー |
![]() |
提出日時 | 2016-02-11 19:21:49 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 193 ms / 5,000 ms |
コード長 | 798 bytes |
コンパイル時間 | 2,089 ms |
コンパイル使用メモリ | 74,304 KB |
実行使用メモリ | 41,864 KB |
最終ジャッジ日時 | 2024-09-22 00:46:01 |
合計ジャッジ時間 | 4,254 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
import java.util.Scanner;class Main {public static void main(String[] args) throws Exception {Scanner in = new Scanner(System.in);int w = in.nextInt();int h = in.nextInt();String c = in.next();in.close();for(int i=0; i<h; i++) {for(int j=0; j<w; j++) {if(c.equals("B")) {System.out.print("B");c = "W";} else {System.out.print("W");c = "B";}}System.out.println();if((w % 2) == 0) {if(c.equals("B")) {c = "W";} else {c = "B";}}}}}