結果

問題 No.8 N言っちゃダメゲーム
ユーザー GrenacheGrenache
提出日時 2015-07-27 18:07:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 159 ms / 5,000 ms
コード長 639 bytes
コンパイル時間 3,209 ms
コンパイル使用メモリ 72,580 KB
実行使用メモリ 58,712 KB
最終ジャッジ日時 2023-09-23 04:01:26
合計ジャッジ時間 5,546 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,968 KB
testcase_01 AC 121 ms
56,028 KB
testcase_02 AC 122 ms
55,760 KB
testcase_03 AC 152 ms
58,680 KB
testcase_04 AC 159 ms
58,168 KB
testcase_05 AC 150 ms
58,192 KB
testcase_06 AC 152 ms
58,280 KB
testcase_07 AC 150 ms
58,712 KB
testcase_08 AC 149 ms
58,328 KB
testcase_09 AC 152 ms
56,432 KB
testcase_10 AC 155 ms
58,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder8 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int p = sc.nextInt();
        for (int i = 0; i < p; i++) {
            int n = sc.nextInt();
            int k = sc.nextInt();
        	
        	boolean[] dp = new boolean[n + 1];
        	int win = n - 1;
        	while (win >= 0) {
        		dp[win] = true;
        		win -= k + 1;
        	}

            if (!dp[0]) {
            	System.out.println("Win");
            } else {
            	System.out.println("Lose");
            }

        }

        sc.close();
    }
}
0