結果

問題 No.82 市松模様
ユーザー spacenautspacenaut
提出日時 2016-05-20 07:15:38
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 723 bytes
コンパイル時間 2,242 ms
コンパイル使用メモリ 74,444 KB
実行使用メモリ 41,724 KB
最終ジャッジ日時 2024-04-16 01:43:59
合計ジャッジ時間 4,665 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
41,324 KB
testcase_01 AC 129 ms
41,080 KB
testcase_02 AC 130 ms
41,160 KB
testcase_03 AC 125 ms
41,212 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 137 ms
41,616 KB
testcase_07 AC 147 ms
41,360 KB
testcase_08 AC 184 ms
41,696 KB
testcase_09 AC 177 ms
41,724 KB
権限があれば一括ダウンロードができます

ソースコード

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