結果
| 問題 | 
                            No.82 市松模様
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2015-08-10 19:25:16 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 182 ms / 5,000 ms | 
| コード長 | 606 bytes | 
| コンパイル時間 | 3,419 ms | 
| コンパイル使用メモリ | 74,512 KB | 
| 実行使用メモリ | 54,544 KB | 
| 最終ジャッジ日時 | 2024-07-18 06:33:59 | 
| 合計ジャッジ時間 | 4,923 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 7 | 
ソースコード
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";
	}
}