結果

問題 No.82 市松模様
ユーザー kimnykimny
提出日時 2017-12-06 10:12:55
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 61 ms / 5,000 ms
コード長 1,693 bytes
コンパイル時間 2,813 ms
コンパイル使用メモリ 104,424 KB
実行使用メモリ 22,820 KB
最終ジャッジ日時 2023-08-19 09:36:07
合計ジャッジ時間 3,571 ms
ジャッジサーバーID
(参考情報)
judge9 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
22,708 KB
testcase_01 AC 56 ms
22,820 KB
testcase_02 AC 56 ms
20,800 KB
testcase_03 AC 56 ms
20,700 KB
testcase_04 AC 56 ms
20,732 KB
testcase_05 AC 56 ms
20,696 KB
testcase_06 AC 57 ms
20,792 KB
testcase_07 AC 57 ms
20,732 KB
testcase_08 AC 61 ms
20,612 KB
testcase_09 AC 61 ms
20,672 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;
using System.Text;
using System.Threading.Tasks;

namespace yukicoder_82 {
    class Program {
        static void Main(string[] args) {
            //B=66,W=87
            string[] s = Console.ReadLine().Split(' ');
            int w = int.Parse(s[0]);
            int h = int.Parse(s[1]);
            char c = char.Parse(s[2]);
            String[,]color = new string[h, w];
            if (c == 66) {
                for (int i = 0; i < h; i++) {
                    for (int k = 0; k < w; k++) {
                        if (i % 2 == 0) {
                            if (k % 2 == 0) color[i, k] = "B";
                            else color[i, k] = "W";
                        } else {
                            if (k % 2 == 0) color[i, k] = "W";
                            else color[i, k] = "B";
                        }
                    }
                }
            } else {
                for (int i = 0; i < h; i++) {
                    for (int k = 0; k < w; k++) {
                        if (i % 2 == 0) {
                            if (k % 2 == 0) color[i, k] = "W";
                            else color[i, k] = "B";
                        } else {
                            if (k % 2 == 0) color[i, k] = "B";
                            else color[i, k] = "W";
                        }
                    }
                }

            }
            for(int i = 0; i < h; i++) {
                for(int k = 0; k < w; k++) {
                    Console.Write(color[i, k]);
                }
                Console.WriteLine();
            }
            Console.ReadLine();
        }
    }
}
0