結果
問題 | No.257 N言っちゃダメゲーム (3) |
ユーザー |
![]() |
提出日時 | 2015-07-31 22:41:07 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 56 ms / 2,000 ms |
コード長 | 842 bytes |
コンパイル時間 | 708 ms |
コンパイル使用メモリ | 81,708 KB |
実行使用メモリ | 25,220 KB |
平均クエリ数 | 3.70 |
最終ジャッジ日時 | 2024-07-16 20:54:13 |
合計ジャッジ時間 | 3,790 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <iostream> #include <algorithm> #include <functional> #include <string> #include <climits> #include <vector> #include <numeric> #include <complex> #include <map> #include <bitset> #include <stack> #include <queue> using namespace std; //#define __int64 long long #define long __int64 #define REP(i,a,b) for(int i=a;i<b;i++) #define rep(i,n) REP(i,0,n) const int Vecy[4] = {0,-1,0,1}; const int Vecx[4] = {1,0,-1,0}; int main(){ int n,k; int mode = 0; //先手 int in = 0; int next; cin >> n >> k; next = (n - 1) % (k + 1); if(next == 0){ next += k + 1; mode = 1; cout << 0 << endl; } while(true){ if(mode == 0){ //自分のターン cout << next << endl; next += k + 1; }else{ //相手のターン cin >> in; if(in >= n){ return 0; } } mode = 1 - mode; } return 0; }