結果

問題 No.82 市松模様
ユーザー fujita
提出日時 2023-05-09 14:50:23
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 53 ms / 5,000 ms
コード長 1,237 bytes
コンパイル時間 14,518 ms
コンパイル使用メモリ 167,160 KB
実行使用メモリ 182,472 KB
最終ジャッジ日時 2024-11-26 01:46:46
合計ジャッジ時間 15,065 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (111 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;

namespace yukicoder
{
    class Program
    {

        static void Main(string[] args)
        {
            var str = Console.ReadLine();
            var g = str.Split(" ");
            string[] strings = new string[] {"B" , "W"};
            string ss = "" ;
            

            int W = int.Parse(g[0]);
            int H = int.Parse(g[1]);
            string C = g[2];
            string C2 = g[2];

            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W ; j++)
                {
                    if (C == "B")
                    {
                        ss = strings[0];
                        C = "W";
                    }
                    
                    else if (C == "W")
                    {
                        ss = strings[1];
                        C = "B";
                    }
                    Console.Write(ss);
                }
                Console.WriteLine();
                if(C2 == "B")
                {
                    C = "W";
                    C2 = "W";
                }
                else
                {
                    C = "B";
                    C2 = "B";
                }
            }
        }
    }
}
0