結果

問題 No.82 市松模様
ユーザー maru
提出日時 2016-03-23 00:02:53
言語 Java
(openjdk 23)
結果
AC  
実行時間 186 ms / 5,000 ms
コード長 623 bytes
コンパイル時間 3,505 ms
コンパイル使用メモリ 75,524 KB
実行使用メモリ 54,500 KB
最終ジャッジ日時 2024-10-01 15:15:45
合計ジャッジ時間 5,712 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class yukicoder_82 {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int w = stdIn.nextInt();
		int h = stdIn.nextInt();
		String c1 = stdIn.next();
		
		String c2 = (c1.equals("W")) ? "B" : "W";
		
		
		for (int i = 1; i <= h; i++) {
			for (int j = 1; j <= w; j++) {
				if (i % 2 == 1) {
					if (j % 2 == 1) {
						System.out.print(c1);
					} else {
						System.out.print(c2);
					}
				} else {
					if (j % 2 == 1) {
						System.out.print(c2);
					} else {
						System.out.print(c1);
					}
				}
			}
			System.out.println();
		}
	}
}
0