結果

問題 No.82 市松模様
ユーザー CroweaCrowea
提出日時 2019-01-31 14:20:08
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 1,078 bytes
コンパイル時間 903 ms
コンパイル使用メモリ 110,968 KB
実行使用メモリ 26,080 KB
最終ジャッジ日時 2024-04-27 14:09:30
合計ジャッジ時間 1,834 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
25,820 KB
testcase_01 AC 24 ms
22,192 KB
testcase_02 AC 24 ms
26,080 KB
testcase_03 AC 23 ms
23,904 KB
testcase_04 AC 23 ms
22,072 KB
testcase_05 AC 25 ms
25,948 KB
testcase_06 AC 24 ms
25,696 KB
testcase_07 AC 25 ms
24,036 KB
testcase_08 AC 25 ms
23,724 KB
testcase_09 AC 25 ms
24,112 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

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