結果

問題 No.82 市松模様
ユーザー soujikisoujiki
提出日時 2015-04-29 20:38:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 173 ms / 5,000 ms
コード長 614 bytes
コンパイル時間 3,191 ms
コンパイル使用メモリ 72,120 KB
実行使用メモリ 55,796 KB
最終ジャッジ日時 2023-09-19 04:12:04
合計ジャッジ時間 5,513 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,472 KB
testcase_01 AC 127 ms
55,660 KB
testcase_02 AC 122 ms
55,704 KB
testcase_03 AC 123 ms
55,564 KB
testcase_04 AC 129 ms
55,460 KB
testcase_05 AC 127 ms
55,232 KB
testcase_06 AC 134 ms
55,792 KB
testcase_07 AC 151 ms
55,568 KB
testcase_08 AC 171 ms
55,580 KB
testcase_09 AC 173 ms
55,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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 str = stdIn.next();
		boolean flag;
		if(str.equals("B")){
			flag = true;
		}
		else{
			flag = false;
		}

		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				if(flag){
					System.out.print("B");
					flag = false;
				}
				else{
					System.out.print("W");
					flag = true;
				}
			}
			if(W%2==0){
				if(flag){
					flag = false;
				}
				else{
					flag = true;
				}
			}
			System.out.println();
		}

	}
}
0