結果
| 問題 |
No.8 N言っちゃダメゲーム
|
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2014-11-16 03:01:09 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 5,000 ms |
| コード長 | 527 bytes |
| コンパイル時間 | 209 ms |
| コンパイル使用メモリ | 22,656 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-31 20:32:27 |
| 合計ジャッジ時間 | 879 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d", &P);
| ~~~~~^~~~~~~~~~
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d %d", &N, &K);
| ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio>
int P;
int N, K;
bool dp[120001];
int main(){
scanf("%d", &P);
for(int i=0;i<P;i++){
scanf("%d %d", &N, &K);
dp[N] = true;
int lost = 0;
for(int j=N-1;j>=0;j--){
if(lost > 0){
dp[j] = true;
}else{
dp[j] = false;
lost += 1;
}
if(j+K <= N){lost -= !dp[j+K];}
}
if(dp[0]){puts("Win");}
else{puts("Lose");}
}
}
tottoripaper