結果

問題 No.82 市松模様
ユーザー aaaaasatoriaaaaasatori
提出日時 2018-02-14 09:52:09
言語 Java19
(openjdk 21)
結果
AC  
実行時間 178 ms / 5,000 ms
コード長 648 bytes
コンパイル時間 4,252 ms
コンパイル使用メモリ 72,224 KB
実行使用メモリ 58,236 KB
最終ジャッジ日時 2023-08-23 07:39:30
合計ジャッジ時間 6,569 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,952 KB
testcase_01 AC 126 ms
55,748 KB
testcase_02 AC 124 ms
55,824 KB
testcase_03 AC 125 ms
55,744 KB
testcase_04 AC 126 ms
55,800 KB
testcase_05 AC 128 ms
55,664 KB
testcase_06 AC 133 ms
55,748 KB
testcase_07 AC 150 ms
56,168 KB
testcase_08 AC 170 ms
55,988 KB
testcase_09 AC 178 ms
58,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No82 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int W = sc.nextInt();
		int H = sc.nextInt();
		String color = sc.next();
		String itimatu[][] = new String[H][W];
		
		for(int i = 0;i < H;i++) {
			for(int j = 0;j < W;j++) {
				itimatu[i][j] = color;
				if(color.equals("B")) {
					color = "W";
				}else {
					color = "B";
				}
			}
			if(itimatu[i][0].equals("B")) {
				color = "W";
			}else {
				color = "B";
			}
		}
		
		for(int i = 0;i < H;i++) {
			for(int j = 0;j < W;j++) {
				System.out.print(itimatu[i][j]);
			}
			System.out.println();
		}
	}
}
0