結果

問題 No.82 市松模様
ユーザー FVRChanFVRChan
提出日時 2017-09-24 15:29:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 161 ms / 5,000 ms
コード長 546 bytes
コンパイル時間 2,382 ms
コンパイル使用メモリ 76,292 KB
実行使用メモリ 55,076 KB
最終ジャッジ日時 2024-04-26 17:33:17
合計ジャッジ時間 4,668 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
54,836 KB
testcase_01 AC 158 ms
55,076 KB
testcase_02 AC 156 ms
54,880 KB
testcase_03 AC 159 ms
54,880 KB
testcase_04 AC 159 ms
54,972 KB
testcase_05 AC 156 ms
54,908 KB
testcase_06 AC 157 ms
55,000 KB
testcase_07 AC 161 ms
54,960 KB
testcase_08 AC 150 ms
54,508 KB
testcase_09 AC 142 ms
54,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Main{
	private static char change(char c){
		if(c=='B')return 'W';
		else return 'B';
	}
	public static void main(String args[])throws Exception{
		Scanner sc=new Scanner(System.in);
		String s[]=sc.nextLine().split(" ");
		int w=Integer.parseInt(s[0]);
		int h=Integer.parseInt(s[1]);
		char c=s[2].charAt(0);
		String s1="",s2="";
		for(int i=0;i<w;i++){
			s1+=c;
			c=change(c);
			s2+=c;
		}
		for(int i=0;i<h;i++){
			if(i%2==0)
				System.out.println(s1);
			else
				System.out.println(s2);
		}
	}
}
0