結果

問題 No.82 市松模様
ユーザー TatsuDXTatsuDX
提出日時 2016-09-08 23:44:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 156 ms / 5,000 ms
コード長 482 bytes
コンパイル時間 2,782 ms
コンパイル使用メモリ 77,244 KB
実行使用メモリ 53,856 KB
最終ジャッジ日時 2024-04-27 18:07:41
合計ジャッジ時間 4,585 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
53,568 KB
testcase_01 AC 107 ms
53,576 KB
testcase_02 AC 100 ms
52,372 KB
testcase_03 AC 121 ms
53,716 KB
testcase_04 AC 110 ms
52,904 KB
testcase_05 AC 110 ms
53,740 KB
testcase_06 AC 121 ms
53,668 KB
testcase_07 AC 124 ms
53,856 KB
testcase_08 AC 143 ms
53,364 KB
testcase_09 AC 156 ms
53,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt(), h = sc.nextInt();
		String s = sc.next(), a, b;
		if(s.charAt(0) == 'B'){
			a = "B";
			b = "W";
		} else {
			a = "W";
			b = "B";
		}
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				if((i+j)%2 == 0){
					System.out.print(a);
				} else {
					System.out.print(b);
				}
			}
			System.out.println();
		}
	}
}
0