結果
| 問題 |
No.351 市松スライドパズル
|
| コンテスト | |
| ユーザー |
No
|
| 提出日時 | 2018-01-24 01:36:31 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 770 ms / 2,000 ms |
| コード長 | 1,362 bytes |
| コンパイル時間 | 813 ms |
| コンパイル使用メモリ | 116,856 KB |
| 実行使用メモリ | 68,096 KB |
| 最終ジャッジ日時 | 2024-12-26 03:57:16 |
| 合計ジャッジ時間 | 10,412 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
namespace y
{
class Program
{
static void Main(string[] args)
{
string[] ss = Console.ReadLine().Split();
int h = int.Parse(ss[0]);
int w = int.Parse(ss[1]);
int n = int.Parse(Console.ReadLine());
string[] a = new string[n];
for (int i = 0; i < n; i++)
{
a[i] = Console.ReadLine();
}
int x = 0, y = h - 1;
for (int i = n - 1; i >= 0; i--)
{
ss = a[i].Split();
if (ss[0] == "R" && (h - 1) - int.Parse(ss[1]) == y)
{
x = x - 1;
if (x < 0) x = w - 1;
}
if (ss[0] == "C" && int.Parse(ss[1]) == x)
{
y = y + 1;
if (y > h - 1) y = 0;
}
}
string ans = "";
if (x % 2 == 1)
{
ans = y % 2 == 0 ? "white" : "black";
}
else
{
ans = y % 2 == 1 ? "white" : "black";
}
if (h % 2 == 1)
{
if (ans == "black") ans = "white";
else ans = "black";
}
Console.WriteLine(ans);
}
}
}
No