結果
問題 | No.82 市松模様 |
ユーザー |
|
提出日時 | 2019-01-31 14:20:08 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 25 ms / 5,000 ms |
コード長 | 1,078 bytes |
コンパイル時間 | 4,310 ms |
コンパイル使用メモリ | 110,428 KB |
実行使用メモリ | 26,076 KB |
最終ジャッジ日時 | 2024-11-15 16:39:22 |
合計ジャッジ時間 | 5,266 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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.
ソースコード
using System;public class Program{public static void Main(string[] args){var s = Console.ReadLine().Split(' ');int w = int.Parse(s[0]);int h = int.Parse(s[1]);string c = s[2];var pattern = string.Empty;if (c == "B"){for (var i = 0; i < h; i++){pattern = string.Empty;for (var j = 0; j < w; j++){if (i % 2 == 0) pattern += (j % 2 == 0) ? "B" : "W";else pattern += (j % 2 == 0) ? "W" : "B";}Console.WriteLine(pattern);}}else{for (var i = 0; i < h; i++){pattern = string.Empty;for (var j = 0; j < w; j++){if (i % 2 == 0) pattern += (j % 2 == 0) ? "W" : "B";else pattern += (j % 2 == 0) ? "B" : "W";}Console.WriteLine(pattern);}}}}