結果

問題 No.82 市松模様
コンテスト
ユーザー maru
提出日時 2016-03-23 00:02:53
言語 Java
(openjdk 26.0.2.1 + ACL)
コンパイル:
javac -J-Duser.language=en -encoding UTF8 -cp /opt/aclib/ac_library.jar _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true -cp .:/opt/aclib/ac_library.jar _class_
結果
AC  
実行時間 83 ms / 5,000 ms
+ 970µs
コード長 623 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,419 ms
コンパイル使用メモリ 86,084 KB
実行使用メモリ 46,420 KB
最終ジャッジ日時 2026-09-07 14:56:01
合計ジャッジ時間 4,400 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.Scanner;

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 c1 = stdIn.next();
		
		String c2 = (c1.equals("W")) ? "B" : "W";
		
		
		for (int i = 1; i <= h; i++) {
			for (int j = 1; j <= w; j++) {
				if (i % 2 == 1) {
					if (j % 2 == 1) {
						System.out.print(c1);
					} else {
						System.out.print(c2);
					}
				} else {
					if (j % 2 == 1) {
						System.out.print(c2);
					} else {
						System.out.print(c1);
					}
				}
			}
			System.out.println();
		}
	}
}
0