結果

問題 No.82 市松模様
ユーザー CroweaCrowea
提出日時 2019-01-31 14:20:08
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 57 ms / 5,000 ms
コード長 1,078 bytes
コンパイル時間 1,102 ms
コンパイル使用メモリ 67,284 KB
実行使用メモリ 22,784 KB
最終ジャッジ日時 2023-08-09 19:32:08
合計ジャッジ時間 2,527 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
22,784 KB
testcase_01 AC 57 ms
22,644 KB
testcase_02 AC 56 ms
22,652 KB
testcase_03 AC 54 ms
22,724 KB
testcase_04 AC 55 ms
20,608 KB
testcase_05 AC 55 ms
20,788 KB
testcase_06 AC 55 ms
18,564 KB
testcase_07 AC 55 ms
20,804 KB
testcase_08 AC 54 ms
20,756 KB
testcase_09 AC 55 ms
20,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

public class Program
{
    public static void Main(string[] args)
    {
        var s = Console.ReadLine().Split(' ');
        int w = int.Parse(s[0]);
        int h = int.Parse(s[1]);
        string c = s[2];

        var pattern = string.Empty;
        if (c == "B")
        {
            for (var i = 0; i < h; i++)
            {
                pattern = string.Empty;
                for (var j = 0; j < w; j++)
                {
                    if (i % 2 == 0) pattern += (j % 2 == 0) ? "B" : "W";
                    else pattern += (j % 2 == 0) ? "W" : "B";
                }
                Console.WriteLine(pattern);
            }
        }
        else
        {
            for (var i = 0; i < h; i++)
            {
                pattern = string.Empty;
                for (var j = 0; j < w; j++)
                {
                    if (i % 2 == 0) pattern += (j % 2 == 0) ? "W" : "B";
                    else pattern += (j % 2 == 0) ? "B" : "W";
                }
                Console.WriteLine(pattern);
            }
        }
    }
}
0