結果

問題 No.82 市松模様
ユーザー r.suzuki
提出日時 2016-01-17 22:23:10
言語 Java
(openjdk 23)
結果
AC  
実行時間 170 ms / 5,000 ms
コード長 506 bytes
コンパイル時間 3,486 ms
コンパイル使用メモリ 74,156 KB
実行使用メモリ 41,836 KB
最終ジャッジ日時 2024-09-19 20:21:18
合計ジャッジ時間 4,932 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

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