結果

問題 No.82 市松模様
ユーザー うわばみうわばみ
提出日時 2020-04-29 18:05:37
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 61 ms / 5,000 ms
コード長 849 bytes
コンパイル時間 1,027 ms
コンパイル使用メモリ 65,660 KB
実行使用メモリ 22,908 KB
最終ジャッジ日時 2023-08-19 12:24:32
合計ジャッジ時間 2,419 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
22,648 KB
testcase_01 AC 60 ms
22,732 KB
testcase_02 AC 59 ms
20,708 KB
testcase_03 AC 60 ms
22,628 KB
testcase_04 AC 60 ms
22,908 KB
testcase_05 AC 60 ms
20,700 KB
testcase_06 AC 60 ms
20,768 KB
testcase_07 AC 60 ms
20,692 KB
testcase_08 AC 60 ms
22,828 KB
testcase_09 AC 61 ms
22,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Text;
using System.Linq;

class Program
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split();
        int w = int.Parse(s[0]);
        int h = int.Parse(s[1]);
        string even = s[2];
        string odd;
        if(even == "W")
        {
            odd = "B";
        }
        else
        {
            odd = "W";
        }
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < h; i++)
        {
            for(int j = 0; j < w; j++)
            {
                if((i + j) % 2 == 0)
                {
                    sb.Append(even);
                }
                else
                {
                    sb.Append(odd);
                }
            }
            sb.Append("\r\n");
        }
        Console.WriteLine($"{sb.ToString().Trim()}");
    }
}
0