結果

問題 No.8 N言っちゃダメゲーム
ユーザー niyarinniyarin
提出日時 2017-04-06 23:46:19
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 701 bytes
コンパイル時間 490 ms
コンパイル使用メモリ 28,564 KB
実行使用メモリ 6,484 KB
最終ジャッジ日時 2023-09-24 21:16:52
合計ジャッジ時間 7,356 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<stdio.h>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)

int N,K;
int P;
int dp[120001];


void solve(){
    REP(i,N){
        dp[i] = 0;
    }
    dp[N-1] = 1;
    
    for(int i=N-2;i>-1;i--){
        int flag = 1;
        for (int j=1;j<=K;j++){
            if ((i+j)>=N){
                break;
            }else if (dp[i+j]){
                flag = 0;
                break;
            }
            
        }
        dp[i] = flag;
    }

    if (dp[0]){
        printf("Lose\n");
    }else{
        printf("Win\n");
    }

}

int main(void){
    scanf("%d",&P);
    REP(i,P){
        scanf("%d %d",&N,&K);
        solve();

    }
    return 0;
}
0