結果
問題 |
No.351 市松スライドパズル
|
ユーザー |
![]() |
提出日時 | 2017-01-10 23:12:50 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 746 ms / 2,000 ms |
コード長 | 2,313 bytes |
コンパイル時間 | 895 ms |
コンパイル使用メモリ | 115,392 KB |
実行使用メモリ | 57,856 KB |
最終ジャッジ日時 | 2024-09-25 03:06:37 |
合計ジャッジ時間 | 9,750 ms |
ジャッジサーバーID (参考情報) |
judge1 / 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; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; using System.IO; class Magatro { static Scanner sc = new Scanner(); static int H, W; static int N; static string[] S; static int[] K; static void Main() { int x = 0,y = 0; Scan(); for(int i = N - 1; i >= 0; i--) { switch (S[i]) { case "R": if (y == K[i]) { x--; if (x < 0) { x = W - 1; } } break; case "C": if (x == K[i]) { y--; if (y < 0) { y = H - 1; } } break; } } if ((x + y) % 2 == 0) { Console.WriteLine("white"); } else { Console.WriteLine("black"); } } static void Scan() { H = sc.NextInt(); W = sc.NextInt(); N = sc.NextInt(); S = new string[N]; K = new int[N]; for (int i = 0; i < N; i++) { S[i] = sc.Next(); K[i] = sc.NextInt(); } } } public class Scanner { public string[] S; private int Index; private char Separator; public Scanner(char separator=' ') { Index = 0; Separator = separator; } public string Next() { string result; if (S == null || Index >= S.Length) { S = Line(); Index = 0; } result = S[Index]; Index++; return result; } private string[] Line() { return Console.ReadLine().Split(Separator); } public int NextInt() { return int.Parse(Next()); } public double NextDouble() { return double.Parse(Next()); } public long NextLong() { return long.Parse(Next()); } }