結果

問題 No.8 N言っちゃダメゲーム
ユーザー mbanmban
提出日時 2016-11-01 05:16:52
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,100 bytes
コンパイル時間 816 ms
コンパイル使用メモリ 110,136 KB
実行使用メモリ 29,688 KB
最終ジャッジ日時 2024-05-03 20:34:47
合計ジャッジ時間 7,355 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
26,204 KB
testcase_01 AC 26 ms
23,768 KB
testcase_02 AC 26 ms
21,940 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Magatro
{
    static int P;
    static int[] N, K;
   static void Main()
    {
        Read();
        for(int i = 0; i < P; i++)
        {
            Console.WriteLine(Ans(N[i], K[i]));
        }
    }
    static string Ans(int n,int k)
    {
        bool[] A = new bool[n+1];
        A[n] = true;
        for(int i = n; i >= 0; i--)
        {

            for(int j = 1; j <= k; j++) {
                if (i - j < 0)
                {
                    break;
                }
                A[i - j] ^= !A[i];
            }
        }
        if (A[0])
        {
            return "Win";
        }
        else
        {
            return "Lose";

        }
    }
    static void Read()
    {
        P = int.Parse(Console.ReadLine());
        N = new int[P];
        K = new int[P];
        for (int i = 0; i<P; i++){
            string[] s = Console.ReadLine().Split(' ');

            N[i] = int.Parse(s[0]);
            K[i] = int.Parse(s[1]);
        }
    }
}


0