結果

問題 No.82 市松模様
ユーザー syokeininsyokeinin
提出日時 2014-12-02 23:53:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 170 ms / 5,000 ms
コード長 543 bytes
コンパイル時間 2,000 ms
コンパイル使用メモリ 71,744 KB
実行使用メモリ 56,376 KB
最終ジャッジ日時 2023-09-02 01:13:02
合計ジャッジ時間 4,109 ms
ジャッジサーバーID
(参考情報)
judge12 / judge16
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,376 KB
testcase_01 AC 122 ms
55,832 KB
testcase_02 AC 122 ms
55,960 KB
testcase_03 AC 118 ms
56,168 KB
testcase_04 AC 129 ms
56,028 KB
testcase_05 AC 125 ms
55,976 KB
testcase_06 AC 128 ms
55,972 KB
testcase_07 AC 143 ms
55,956 KB
testcase_08 AC 167 ms
56,244 KB
testcase_09 AC 170 ms
56,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	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