結果

問題 No.82 市松模様
ユーザー spacenaut
提出日時 2016-05-20 07:15:38
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 723 bytes
コンパイル時間 2,296 ms
コンパイル使用メモリ 75,120 KB
実行使用メモリ 54,300 KB
最終ジャッジ日時 2024-10-06 11:09:23
合計ジャッジ時間 4,499 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class No0082{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int h = sc.nextInt();
		String c = sc.next();
		String d;
		String temp = "";

		System.out.print(c);
		d = c;
		if(w != 1 && h != 1){
			for(int i = 0; i < h; i++){
				for(int j = 0; j < w; j++){
					if(d.equals("B")){
						System.out.print("W");
						d = "W";
					}else{
						System.out.print("B");
						d = "B";
					}
					if(j + 1 == w){
						temp = d;
					}
					if(i == 0 && j + 2 == w){
						temp = d;
						break;
					}
				}
				System.out.println();
				if(w % 2 == 0){
					if(temp == "B"){
						d = "W";
					}else{
						d = "B";
					}
				}
			}
		}
	}
}
0