結果

問題 No.351 市松スライドパズル
ユーザー mbanmban
提出日時 2017-01-10 23:12:50
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 762 ms / 2,000 ms
コード長 2,313 bytes
コンパイル時間 1,150 ms
コンパイル使用メモリ 111,956 KB
実行使用メモリ 63,796 KB
最終ジャッジ日時 2023-10-25 07:51:18
合計ジャッジ時間 10,158 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 698 ms
63,796 KB
testcase_01 AC 24 ms
24,064 KB
testcase_02 AC 26 ms
24,064 KB
testcase_03 AC 26 ms
24,064 KB
testcase_04 AC 25 ms
24,064 KB
testcase_05 AC 25 ms
24,064 KB
testcase_06 AC 26 ms
24,064 KB
testcase_07 AC 25 ms
24,064 KB
testcase_08 AC 25 ms
24,064 KB
testcase_09 AC 25 ms
24,064 KB
testcase_10 AC 25 ms
24,064 KB
testcase_11 AC 25 ms
24,080 KB
testcase_12 AC 25 ms
24,080 KB
testcase_13 AC 742 ms
62,984 KB
testcase_14 AC 746 ms
63,296 KB
testcase_15 AC 761 ms
63,780 KB
testcase_16 AC 762 ms
63,796 KB
testcase_17 AC 759 ms
63,792 KB
testcase_18 AC 746 ms
63,796 KB
testcase_19 AC 755 ms
63,792 KB
testcase_20 AC 746 ms
63,796 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;
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());
    }
}
0