結果
問題 | No.82 市松模様 |
ユーザー |
![]() |
提出日時 | 2018-04-23 23:52:45 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 189 ms / 5,000 ms |
コード長 | 851 bytes |
コンパイル時間 | 2,687 ms |
コンパイル使用メモリ | 77,224 KB |
実行使用メモリ | 41,956 KB |
最終ジャッジ日時 | 2024-06-27 14:10:19 |
合計ジャッジ時間 | 4,149 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int W = scan.nextInt(); int H = scan.nextInt(); String C = scan.next(); scan.close(); String temp = C; if(W % 2 == 0) { for(int i = 0; i < H; i++) { for(int j = 0; j < W; j++) { if(temp.equals("W")) { System.out.print(temp); temp = "B"; }else { System.out.print(temp); temp = "W"; } } System.out.println(); if(temp.equals("W")) { temp = "B"; }else { temp = "W"; } } }else { for(int i = 0; i < H; i++) { for(int j = 0; j < W; j++) { if(temp.equals("W")) { System.out.print(temp); temp = "B"; }else { System.out.print(temp); temp = "W"; } } System.out.println(); } } } }