結果

問題 No.82 市松模様
ユーザー 練習生
提出日時 2015-08-14 20:21:39
言語 Java
(openjdk 23)
結果
AC  
実行時間 179 ms / 5,000 ms
コード長 530 bytes
コンパイル時間 2,982 ms
コンパイル使用メモリ 74,828 KB
実行使用メモリ 41,988 KB
最終ジャッジ日時 2024-07-18 09:29:37
合計ジャッジ時間 4,912 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class No82 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int h = sc.nextInt();
		String c = sc.next();
		sc.close();
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				if(c.equals("B")){
					System.out.print("B");
					c = "W";
				}else{
					System.out.print("W");
					c = "B";
				}
			}
			System.out.println();
			if((w % 2) == 0){
				if(c.equals("B")){
					c = "W";
				}else{
					c = "B";
				}
			}
		}
	}
}
0