結果

問題 No.82 市松模様
ユーザー syokeininsyokeinin
提出日時 2014-12-03 00:04:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 171 ms / 5,000 ms
コード長 560 bytes
コンパイル時間 1,954 ms
コンパイル使用メモリ 71,276 KB
実行使用メモリ 56,328 KB
最終ジャッジ日時 2023-09-02 01:16:07
合計ジャッジ時間 4,174 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,652 KB
testcase_01 AC 125 ms
55,400 KB
testcase_02 AC 121 ms
55,900 KB
testcase_03 AC 123 ms
55,656 KB
testcase_04 AC 130 ms
55,836 KB
testcase_05 AC 127 ms
55,768 KB
testcase_06 AC 132 ms
56,328 KB
testcase_07 AC 146 ms
56,108 KB
testcase_08 AC 171 ms
55,820 KB
testcase_09 AC 171 ms
55,960 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){
		String b = "B";
		if(c.equals(b)){
			return "W";
		}else{
			return b;
		}
	}
}
0