結果

問題 No.82 市松模様
ユーザー 37zigen
提出日時 2016-03-12 18:27:08
言語 Java
(openjdk 23)
結果
AC  
実行時間 187 ms / 5,000 ms
コード長 726 bytes
コンパイル時間 3,518 ms
コンパイル使用メモリ 76,644 KB
実行使用メモリ 54,496 KB
最終ジャッジ日時 2024-09-25 03:21:42
合計ジャッジ時間 5,565 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

package 練習;
import java.util.Date;
import java.util.Scanner;

public class main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		long exec_time=new Date().getTime();
		
		int w=sc.nextInt();
		int h=sc.nextInt();
		char s_1=sc.next().charAt(0);
		char s_2;
		if(s_1=='B'){
			s_2='W';
		}else if(s_1=='W'){
			s_2='B';
		}else{
			System.err.println("Erro_at19");
			s_2=' ';
		}
		
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if((i+j)%2==0){
					System.out.print(s_1);
				}else if((i+j)%2==1){
					System.out.print(s_2);
				}else{
					System.err.print("Error_at27");
				}
			}
			System.out.println();
		}
		
		System.err.println(new Date().getTime()-exec_time+"ms");
	}
}

0