結果

問題 No.82 市松模様
ユーザー 練習生練習生
提出日時 2015-08-14 20:21:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 179 ms / 5,000 ms
コード長 530 bytes
コンパイル時間 3,319 ms
コンパイル使用メモリ 72,996 KB
実行使用メモリ 56,108 KB
最終ジャッジ日時 2023-09-25 11:48:14
合計ジャッジ時間 5,540 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,620 KB
testcase_01 AC 128 ms
53,812 KB
testcase_02 AC 127 ms
55,676 KB
testcase_03 AC 128 ms
55,576 KB
testcase_04 AC 131 ms
55,996 KB
testcase_05 AC 130 ms
55,832 KB
testcase_06 AC 138 ms
55,952 KB
testcase_07 AC 160 ms
56,100 KB
testcase_08 AC 176 ms
55,948 KB
testcase_09 AC 179 ms
56,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class No82 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int h = sc.nextInt();
		String c = sc.next();
		sc.close();
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				if(c.equals("B")){
					System.out.print("B");
					c = "W";
				}else{
					System.out.print("W");
					c = "B";
				}
			}
			System.out.println();
			if((w % 2) == 0){
				if(c.equals("B")){
					c = "W";
				}else{
					c = "B";
				}
			}
		}
	}
}
0