結果
問題 | No.82 市松模様 |
ユーザー |
![]() |
提出日時 | 2016-06-04 14:50:00 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 204 ms / 5,000 ms |
コード長 | 938 bytes |
コンパイル時間 | 3,925 ms |
コンパイル使用メモリ | 77,844 KB |
実行使用メモリ | 54,596 KB |
最終ジャッジ日時 | 2024-10-08 07:51:41 |
合計ジャッジ時間 | 6,121 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 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.print("\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"); } } } } }