結果

問題 No.8 N言っちゃダメゲーム
ユーザー hogekihogeki
提出日時 2016-07-31 20:16:30
言語 C#(csc)
(csc 3.9.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,174 bytes
コンパイル時間 733 ms
コンパイル使用メモリ 103,808 KB
実行使用メモリ 18,176 KB
最終ジャッジ日時 2024-04-24 13:26:37
合計ジャッジ時間 1,517 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
17,664 KB
testcase_01 AC 22 ms
17,536 KB
testcase_02 AC 19 ms
17,664 KB
testcase_03 AC 24 ms
17,664 KB
testcase_04 AC 23 ms
17,664 KB
testcase_05 AC 22 ms
17,664 KB
testcase_06 AC 25 ms
17,536 KB
testcase_07 AC 24 ms
17,792 KB
testcase_08 AC 26 ms
17,664 KB
testcase_09 AC 26 ms
17,664 KB
testcase_10 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace NDame
{
    class Program
    {
        static void Main(string[] args)
        {
            int P = int.Parse(Console.ReadLine());
            int[] N = new int[P];
            int[] K = new int[P];
            
            for(int i=0; i< P; i++)
            {
                string[] vals = Console.ReadLine().Split(' ');
                N[i] = int.Parse(vals[0]);
                K[i] = int.Parse(vals[1]);
            }

            for(int i=0; i < P; i++)
            {
                if (K[i] >= N[i])
                {
                    Console.WriteLine("Win");
                    continue;
                }

                int y = K[i] + 1;
                bool win = false;

                for (int k = 1; k <= K[i]; k++)
                {
                    int x = N[i] - k - 1;
                    if (x >= y && x % y == 0)
                    {
                        win = true;
                        break;
                    }
                }
                if (win)
                    Console.WriteLine("Win");
                else
                    Console.WriteLine("Lose");

            }
        }
    }
}
0