結果

問題 No.82 市松模様
ユーザー 37zigen37zigen
提出日時 2016-03-12 18:27:08
言語 Java19
(openjdk 21)
結果
AC  
実行時間 192 ms / 5,000 ms
コード長 726 bytes
コンパイル時間 5,412 ms
コンパイル使用メモリ 87,004 KB
実行使用メモリ 57,960 KB
最終ジャッジ日時 2023-10-25 08:08:48
合計ジャッジ時間 6,020 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
57,604 KB
testcase_01 AC 132 ms
56,320 KB
testcase_02 AC 142 ms
57,776 KB
testcase_03 AC 140 ms
57,868 KB
testcase_04 AC 135 ms
56,312 KB
testcase_05 AC 144 ms
57,832 KB
testcase_06 AC 148 ms
57,560 KB
testcase_07 AC 157 ms
57,780 KB
testcase_08 AC 192 ms
57,960 KB
testcase_09 AC 185 ms
57,620 KB
権限があれば一括ダウンロードができます

ソースコード

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