結果

問題 No.82 市松模様
ユーザー rf141rf141
提出日時 2015-08-10 19:25:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 181 ms / 5,000 ms
コード長 606 bytes
コンパイル時間 3,129 ms
コンパイル使用メモリ 72,144 KB
実行使用メモリ 56,352 KB
最終ジャッジ日時 2023-09-25 07:57:24
合計ジャッジ時間 5,388 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,704 KB
testcase_01 AC 122 ms
55,944 KB
testcase_02 AC 121 ms
55,680 KB
testcase_03 AC 122 ms
55,748 KB
testcase_04 AC 128 ms
56,092 KB
testcase_05 AC 126 ms
55,724 KB
testcase_06 AC 131 ms
55,524 KB
testcase_07 AC 152 ms
56,352 KB
testcase_08 AC 181 ms
55,940 KB
testcase_09 AC 179 ms
55,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class kadomatsu2{
	public static void main(String... args){
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int h = scan.nextInt();
		String start = scan.next();
		make(w,h,start);
	}
	public static void make(int w,int h,String start){
		String next = whatNext(start),first=start;
		for(int i = 1; i <= h; i++){
			for(int j = 1; j <= w; j++){
				System.out.print((j%2!=0)?first:next);
			}
			System.out.print("\n");
			next = first;
			first = whatNext(next);
		}
	}
	public static String whatNext(String start){
		return (start.equals("B"))?"W":"B";
	}
}
0