結果
| 問題 |
No.8 N言っちゃダメゲーム
|
| ユーザー |
mban
|
| 提出日時 | 2016-11-01 05:25:37 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 71 ms / 5,000 ms |
| コード長 | 1,174 bytes |
| コンパイル時間 | 934 ms |
| コンパイル使用メモリ | 111,588 KB |
| 実行使用メモリ | 33,400 KB |
| 最終ジャッジ日時 | 2024-11-25 00:38:32 |
| 合計ジャッジ時間 | 2,064 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
コンパイルメッセージ
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.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]);
}
}
}
mban