結果
問題 | No.8 N言っちゃダメゲーム |
ユーザー | core123 |
提出日時 | 2019-04-17 16:51:30 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 212 ms / 5,000 ms |
コード長 | 1,169 bytes |
コンパイル時間 | 2,877 ms |
コンパイル使用メモリ | 78,948 KB |
実行使用メモリ | 60,188 KB |
最終ジャッジ日時 | 2023-10-22 07:29:41 |
合計ジャッジ時間 | 5,227 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 129 ms
57,396 KB |
testcase_01 | AC | 128 ms
57,384 KB |
testcase_02 | AC | 131 ms
57,456 KB |
testcase_03 | AC | 198 ms
60,112 KB |
testcase_04 | AC | 208 ms
60,108 KB |
testcase_05 | AC | 212 ms
60,112 KB |
testcase_06 | AC | 182 ms
60,116 KB |
testcase_07 | AC | 185 ms
60,048 KB |
testcase_08 | AC | 190 ms
60,156 KB |
testcase_09 | AC | 189 ms
60,012 KB |
testcase_10 | AC | 197 ms
60,188 KB |
ソースコード
import java.util.*; import java.util.stream.*; import static java.lang.Math.*; public class Main{ public static void main(String... args){ Scanner sc=new Scanner(System.in); int p=sc.nextInt(); for(int pp=0;pp<p;pp++){ int n=sc.nextInt(); int k=sc.nextInt(); int[] grundy=new int[n+1]; grundy[n-1]=0; for(int i=n-2;i>=0;i--){ grundy[i]=(n-1-i)%(k+1); } //put(Arrays.toString(grundy)); if(grundy[0]>0){ put("Win"); }else{ put("Lose"); } } } public static class Pair{ final int x,y; Pair(int x,int y){ this.x=x; this.y=y; } @Override public String toString(){ return String.format("Pair(%d,%d)",x,y); } } public static void print(Object object){ System.out.print(object); } public static void put(Object object) { System.out.println(object); } public static void put(){ System.out.println(); } public static void print(String format,Object... args){ System.out.print(String.format(format,args)); } public static void put(String format,Object... args) { System.out.println(String.format(format,args)); } }