結果

問題 No.82 市松模様
ユーザー syokeininsyokeinin
提出日時 2014-12-03 00:02:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 176 ms / 5,000 ms
コード長 545 bytes
コンパイル時間 1,978 ms
コンパイル使用メモリ 72,744 KB
実行使用メモリ 58,472 KB
最終ジャッジ日時 2023-09-02 01:15:55
合計ジャッジ時間 4,008 ms
ジャッジサーバーID
(参考情報)
judge12 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
56,108 KB
testcase_01 AC 118 ms
55,944 KB
testcase_02 AC 118 ms
55,824 KB
testcase_03 AC 118 ms
56,280 KB
testcase_04 AC 123 ms
56,124 KB
testcase_05 AC 121 ms
55,800 KB
testcase_06 AC 124 ms
55,944 KB
testcase_07 AC 143 ms
58,472 KB
testcase_08 AC 167 ms
56,136 KB
testcase_09 AC 176 ms
56,648 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 = next(next(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