結果

問題 No.8 N言っちゃダメゲーム
ユーザー Grenache
提出日時 2015-07-27 18:07:14
言語 Java
(openjdk 23)
結果
AC  
実行時間 160 ms / 5,000 ms
コード長 639 bytes
コンパイル時間 3,702 ms
コンパイル使用メモリ 75,436 KB
実行使用メモリ 57,212 KB
最終ジャッジ日時 2024-07-16 04:12:32
合計ジャッジ時間 5,317 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

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