結果

問題 No.8 N言っちゃダメゲーム
ユーザー rn4rurn4ru
提出日時 2016-04-13 01:52:23
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 623 bytes
コンパイル時間 2,006 ms
コンパイル使用メモリ 74,568 KB
実行使用メモリ 61,432 KB
最終ジャッジ日時 2024-04-15 00:21:19
合計ジャッジ時間 9,021 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
54,036 KB
testcase_01 AC 134 ms
54,092 KB
testcase_02 AC 135 ms
53,964 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int P = scanner.nextInt();
		for (int i = 0; i < P; i++) {
			int N = scanner.nextInt();
			int K = scanner.nextInt();
			f(N, K);
		}
	}

	private static void f(int n, int k) {
		boolean[] win = new boolean[n + 1];
		for (int i = n; i >= 0; i--) {
			for (int j = 1; j <= k; j++) {
				if (i + j > n - 1)
					break;
				if (!win[i + j]) {
					win[i] = true;
					break;
				}
			}
		}

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

}
0