結果
問題 | No.8 N言っちゃダメゲーム |
ユーザー |
![]() |
提出日時 | 2015-05-06 00:26:12 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 159 ms / 5,000 ms |
コード長 | 637 bytes |
コンパイル時間 | 2,352 ms |
コンパイル使用メモリ | 75,196 KB |
実行使用メモリ | 45,988 KB |
最終ジャッジ日時 | 2024-07-05 19:10:15 |
合計ジャッジ時間 | 3,810 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); final int P = sc.nextInt(); for(int i = 0; i < P; i++){ final int N = sc.nextInt(); final int K = sc.nextInt(); boolean[] win = new boolean[N]; win[N - 1] = false; int last_lose = N - 1; for(int cur = N - 2; cur >= 0; cur--){ if(cur + K >= last_lose){ win[cur] = true; }else{ win[cur] = false; last_lose = cur; } } //System.out.println(Arrays.toString(win)); System.out.println(win[0] ? "Win" : "Lose"); } } }