結果

問題 No.8 N言っちゃダメゲーム
ユーザー mbanmban
提出日時 2016-11-01 05:25:37
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 113 ms / 5,000 ms
コード長 1,174 bytes
コンパイル時間 2,186 ms
コンパイル使用メモリ 101,864 KB
実行使用メモリ 32,148 KB
最終ジャッジ日時 2023-08-16 12:08:55
合計ジャッジ時間 3,860 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
20,648 KB
testcase_01 AC 56 ms
20,624 KB
testcase_02 AC 56 ms
20,760 KB
testcase_03 AC 87 ms
25,560 KB
testcase_04 AC 113 ms
32,148 KB
testcase_05 AC 112 ms
30,160 KB
testcase_06 AC 76 ms
23,564 KB
testcase_07 AC 78 ms
23,900 KB
testcase_08 AC 83 ms
26,800 KB
testcase_09 AC 83 ms
24,844 KB
testcase_10 AC 86 ms
27,296 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.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[0] = true;
        for(int i = 0; i<n; i++)
        {
            if (A[i])
            {
                continue;
            }
            for(int j = 1; j <= k; j++) {
                if (i + j >=n+1)
                {
                    break;
                }
                A[i + j] |= !A[i];
            }
        }
        if (A[n])
        {
            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