結果

問題 No.8 N言っちゃダメゲーム
ユーザー youjo_yamiotiyoujo_yamioti
提出日時 2018-12-02 09:38:42
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 483 bytes
コンパイル時間 1,286 ms
コンパイル使用メモリ 145,628 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-10 19:43:32
合計ジャッジ時間 3,085 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,376 KB
testcase_02 WA -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:24: warning: ‘N’ is used uninitialized in this function [-Wuninitialized]
     vector<int> judge(N+1,0);
                       ~^~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
    int P,N,K;
    vector<int> judge(N+1,0);
    cin >> P;
    int i;
    for(i=0;i<P;i++){
        cin >> N >> K;
        judge[N-1] = 0;
        for(int j=N-2;j>=0;j--){
            for(int k=1;k<=K;k++){
                if(j + k > N) break;
                if(judge[j+k] == 0) judge[j] = 1;
            }
        }
        if(judge[0] == 1) cout << "Win" << endl;
        else cout << "Lose" << endl;
    }
    return 0;
}
0