結果
| 問題 |
No.351 市松スライドパズル
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-28 14:41:01 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 718 ms / 2,000 ms |
| コード長 | 1,286 bytes |
| コンパイル時間 | 1,037 ms |
| コンパイル使用メモリ | 109,544 KB |
| 実行使用メモリ | 56,704 KB |
| 最終ジャッジ日時 | 2024-09-25 03:07:20 |
| 合計ジャッジ時間 | 9,331 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
static string Solve(int w, int h, int n, string[] slist, int[] klist)
{
int x = 0, y = 0;
for (int ii = n - 1; ii >= 0; --ii)
{
if (slist[ii] == "R" && klist[ii] == y)
{
x = (x - 1 < 0) ? w - 1 : x - 1;
}
else if (slist[ii] == "C" && klist[ii] == x)
{
y = (y - 1 < 0) ? h - 1 : y - 1;
}
}
return ((x + y) % 2 == 0) ? "white" : "black";
}
static string No_351()
{
// h w
String[] str = Console.ReadLine().Split(' ');
int h = Int32.Parse(str[0]);
int w = Int32.Parse(str[1]);
// n
int n = Int32.Parse(Console.ReadLine());
// S K
string[] slist = new string[n];
int[] klist = new int[n];
for (int ii = 0; ii < n ; ++ii)
{
str = Console.ReadLine().Split(' ');
slist[ii] = str[0];
klist[ii] = Int32.Parse(str[1]);
}
return Solve(w, h, n, slist, klist);
}
static void Main(string[] args)
{
Console.WriteLine(No_351());
}
}