結果

問題 No.82 市松模様
ユーザー Suunn
提出日時 2018-11-20 06:09:33
言語 Java
(openjdk 23)
結果
AC  
実行時間 230 ms / 5,000 ms
コード長 471 bytes
コンパイル時間 2,136 ms
コンパイル使用メモリ 74,212 KB
実行使用メモリ 41,832 KB
最終ジャッジ日時 2024-12-24 15:24:03
合計ジャッジ時間 4,439 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
	

public class Main{
	
	
	public static void main(String args[])throws Exception{
		
		Scanner sc = new Scanner(System.in);
		int W = sc.nextInt();
		int H = sc.nextInt();
		String c = sc.next();
		char C = c.charAt(0);
		char notC = (char) ('B' + 'W' - C);
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				if((i+j)%2==0){
					System.out.print(C);
				}else{
					System.out.print(notC);
				}
			}
			System.out.println();
		}
		
		
	}
}
0