結果

問題 No.82 市松模様
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-09 19:01:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 193 ms / 5,000 ms
コード長 638 bytes
コンパイル時間 2,899 ms
コンパイル使用メモリ 74,404 KB
実行使用メモリ 41,676 KB
最終ジャッジ日時 2024-04-16 20:54:20
合計ジャッジ時間 4,589 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
41,352 KB
testcase_01 AC 134 ms
41,452 KB
testcase_02 AC 132 ms
41,212 KB
testcase_03 AC 129 ms
41,360 KB
testcase_04 AC 140 ms
41,484 KB
testcase_05 AC 137 ms
41,044 KB
testcase_06 AC 146 ms
41,276 KB
testcase_07 AC 167 ms
41,360 KB
testcase_08 AC 193 ms
41,676 KB
testcase_09 AC 183 ms
41,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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