結果

問題 No.82 市松模様
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-09 10:35:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 974 bytes
コンパイル時間 4,189 ms
コンパイル使用メモリ 73,760 KB
実行使用メモリ 53,772 KB
最終ジャッジ日時 2023-09-17 18:58:39
合計ジャッジ時間 4,146 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
53,772 KB
testcase_01 AC 120 ms
39,476 KB
testcase_02 AC 123 ms
39,208 KB
testcase_03 AC 122 ms
39,060 KB
testcase_04 AC 125 ms
39,892 KB
testcase_05 AC 124 ms
39,104 KB
testcase_06 AC 120 ms
39,872 KB
testcase_07 AC 125 ms
39,152 KB
testcase_08 AC 127 ms
40,124 KB
testcase_09 AC 125 ms
39,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner koko = new Scanner(System.in);
        int w = koko.nextInt();
        int h = koko.nextInt();
        String c = koko.next();
        char[][] iro = new char[h][w];
        if(c.equals("B")){
            for(int i=0; i<h; i++){
                for(int j=0; j<w; j++){
                    if((i+j)%2==0){
                        iro[i][j]='B';
                    }else{
                        iro[i][j]='W';
                    }
                }
                System.out.println(iro[i]);
            }
        }else{
            for(int i=0; i<h; i++){
                for(int j=0; j<w; j++){
                    if((i+j)%2==0){
                        iro[i][j]='W';
                    }else{
                        iro[i][j]='B';
                    }
                }
                System.out.println(iro[i]);
            }
        }
    }
}
0