結果

問題 No.82 市松模様
ユーザー fujitafujita
提出日時 2023-05-09 14:50:23
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 53 ms / 5,000 ms
コード長 1,237 bytes
コンパイル時間 9,213 ms
コンパイル使用メモリ 145,784 KB
実行使用メモリ 166,756 KB
最終ジャッジ日時 2023-08-17 07:01:33
合計ジャッジ時間 10,441 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
28,488 KB
testcase_01 AC 49 ms
28,324 KB
testcase_02 AC 49 ms
30,308 KB
testcase_03 AC 47 ms
28,280 KB
testcase_04 AC 48 ms
28,520 KB
testcase_05 AC 48 ms
28,540 KB
testcase_06 AC 49 ms
28,328 KB
testcase_07 AC 49 ms
28,700 KB
testcase_08 AC 52 ms
28,120 KB
testcase_09 AC 53 ms
166,756 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  Determining projects to restore...
  Restored /home/judge/data/code/main.csproj (in 145 ms).
.NET 向け Microsoft (R) Build Engine バージョン 17.0.0-preview-21470-01+cb055d28f
Copyright (C) Microsoft Corporation.All rights reserved.

  プレビュー版の .NET を使用しています。https://aka.ms/dotnet-core-preview をご覧ください
  main -> /home/judge/data/code/bin/Release/net6.0/main.dll
  main -> /home/judge/data/code/bin/Release/net6.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