結果
| 問題 |
No.8 N言っちゃダメゲーム
|
| コンテスト | |
| ユーザー |
Kuphony
|
| 提出日時 | 2016-03-17 18:00:16 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 847 bytes |
| コンパイル時間 | 514 ms |
| コンパイル使用メモリ | 62,380 KB |
| 実行使用メモリ | 10,144 KB |
| 最終ジャッジ日時 | 2024-10-01 08:51:37 |
| 合計ジャッジ時間 | 6,921 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 TLE * 1 -- * 7 |
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#define MAX 10000
using namespace std;
int main(int argc, const char * argv[]) {
int P;
cin >> P;
int array[P][2];
for (int i = 0; i < P*2; i++) {
cin >> array[i/2][i%2];
}
for (int x = 0; x < P; x++) {
int n = array[x][0];
int k = array[x][1];
//動的計画法で解く
bool dp[n];
//初期化
for (int i = 0; i <= n; i++) {
dp[i] = false;
}
dp[0] = true;
//埋めていく
for (int i = 0; i <= n; i++) {
for (int j = 1; j <= k; j++) {
if(i - j < 0)break;
dp[i] |= !dp[i - j];
}
}
if(dp[n])cout << "Win\n";
else cout << "Lose\n";
}
}
Kuphony