結果
問題 | No.249 N言っちゃダメゲーム (2) |
ユーザー | fiord |
提出日時 | 2015-07-24 22:34:39 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 397 bytes |
コンパイル時間 | 1,266 ms |
コンパイル使用メモリ | 143,648 KB |
実行使用メモリ | 4,376 KB |
最終ジャッジ日時 | 2023-09-22 22:30:21 |
合計ジャッジ時間 | 1,614 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,376 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; bool test(int n,int k){ if(n==0) return false; if(n<0) return true; for(int i=1;i<=k;i++){ if(!test(n-i,k)) return true; } return false; } int main(){ int win=0; bool lose=false; int n,k; cin>>n>>k; if(test(n,k)) win++; else lose=true; for(int i=1;i<1000;i++){ cin>>n>>k; if(lose) win++; lose^=1; } cout<<win<<endl; return 0; }