結果

問題 No.82 市松模様
ユーザー syokeininsyokeinin
提出日時 2014-12-02 23:57:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 176 ms / 5,000 ms
コード長 587 bytes
コンパイル時間 1,956 ms
コンパイル使用メモリ 71,412 KB
実行使用メモリ 56,284 KB
最終ジャッジ日時 2023-09-02 01:13:56
合計ジャッジ時間 4,130 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,640 KB
testcase_01 AC 122 ms
53,940 KB
testcase_02 AC 121 ms
55,972 KB
testcase_03 AC 122 ms
55,632 KB
testcase_04 AC 128 ms
55,560 KB
testcase_05 AC 125 ms
55,736 KB
testcase_06 AC 128 ms
56,088 KB
testcase_07 AC 146 ms
56,044 KB
testcase_08 AC 169 ms
56,284 KB
testcase_09 AC 176 ms
56,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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