結果
問題 |
No.82 市松模様
|
ユーザー |
![]() |
提出日時 | 2016-06-04 14:48:00 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 940 bytes |
コンパイル時間 | 5,132 ms |
コンパイル使用メモリ | 77,744 KB |
実行使用メモリ | 54,484 KB |
最終ジャッジ日時 | 2024-10-08 07:50:43 |
合計ジャッジ時間 | 5,556 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 7 |
ソースコード
package yukicoder; import java.util.Scanner; public class Yuki82 { 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(); for (int j = 1; j <= h; j++) { for (int i = 1; i <= w; i++) { test(c,j,i); } System.out.println("\n"); } } private static void test(String str,int j,int i) { if("B".equals(str)){ if(j%2 == 0) { if (i%2 == 0){ System.out.print("B"); } else { System.out.print("W"); } }else { if (i%2 != 0){ System.out.print("B"); } else { System.out.print("W"); } } } else { if(j%2 == 0) { if (i%2 == 0){ System.out.print("W"); } else { System.out.print("B"); } }else { if (i%2 != 0){ System.out.print("W"); } else { System.out.print("B"); } } } } }