結果

問題 No.82 市松模様
ユーザー mban
提出日時 2016-11-07 12:41:50
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 753 bytes
コンパイル時間 841 ms
コンパイル使用メモリ 112,392 KB
実行使用メモリ 26,016 KB
最終ジャッジ日時 2024-11-25 03:50:15
合計ジャッジ時間 1,410 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 Magatro
{
    static void Main()
    {
        int W, H;
        string c;
        string[] s = Console.ReadLine().Split(' ');
        W = int.Parse(s[0]);
        H = int.Parse(s[1]);
        c = s[2];
        string b = c == "B" ? "W" : "B";
        for(int i = 0; i < H; i++)
        {
            for(int j = 0; j < W; j++)
            {
                if (j % 2 == 0)
                {
                    Console.Write(c);

                }
                else
                {
                    Console.Write(b);
                }
            }
            Console.WriteLine();
            string q = b;
            b = c;
            c = q;
        }
      
    }
}
0