結果

問題 No.82 市松模様
コンテスト
ユーザー 大谷祐翔
提出日時 2025-11-06 15:17:49
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 55 ms / 5,000 ms
コード長 1,176 bytes
コンパイル時間 18,080 ms
コンパイル使用メモリ 169,704 KB
実行使用メモリ 186,088 KB
最終ジャッジ日時 2025-11-06 15:18:09
合計ジャッジ時間 9,046 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (113 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

class Program
{
    static void Main(string[] args)
    {
        string[] inputData = Console.ReadLine()!.Split(' ');
        int width = int.Parse(inputData[0]);
        int height = int.Parse(inputData[1]);

        for (int i = 1; i <= height; i++)
        {
            for (int j = 1; j <= width; j++)
            {
                if (inputData[2] == "B")
                {
                    if (j % 2 == 0)
                    {
                        Console.Write("W");
                    }
                    else
                    {
                        Console.Write("B");
                    }
                }
                else
                {
                    if (j % 2 == 0)
                    {
                        Console.Write("B");
                    }
                    else
                    {
                        Console.Write("W");
                    }
                }
            }
            if (inputData[2] == "B")
            {
                inputData[2] = "W";
            }
            else
            {
                inputData[2] = "B";
            }
            Console.WriteLine();
        }
    }
}
0