結果

問題 No.82 市松模様
ユーザー TaK7907TaK7907
提出日時 2019-11-17 15:30:07
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 28 ms / 5,000 ms
コード長 851 bytes
コンパイル時間 916 ms
コンパイル使用メモリ 109,440 KB
実行使用メモリ 24,196 KB
最終ジャッジ日時 2023-10-25 21:10:17
合計ジャッジ時間 2,151 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

class Yuki0082
{
    static int w, h;
    static char c;

    static void Solve()
    {
        string cells;
        if(c == 'W') cells = "WB";
        else cells = "BW";

        for(var i = 0; i != h; ++i) {
            for(var j = 0; j != w; ++j) {
                if(i % 2 == 0) {
                    Console.Write(j % 2 == 0 ? cells[0] : cells[1]);
                }
                else {
                    Console.Write(j % 2 == 0 ? cells[1] : cells[0]);
                }
            }
            Console.WriteLine();
        }
    }

    static void Scan()
    {
        var buf = Console.ReadLine().Split();
        w = int.Parse(buf[0]);
        h = int.Parse(buf[1]);
        c = buf[2][0];
    }

    static void Main()
    {
        Scan();
        Solve();
    }
}
0