結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー imulanimulan
提出日時 2016-02-05 20:33:10
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 997 bytes
コンパイル時間 1,124 ms
コンパイル使用メモリ 143,672 KB
実行使用メモリ 24,396 KB
平均クエリ数 3.70
最終ジャッジ日時 2023-09-23 08:50:28
合計ジャッジ時間 4,274 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
24,396 KB
testcase_01 AC 44 ms
23,424 KB
testcase_02 AC 45 ms
23,460 KB
testcase_03 AC 45 ms
23,460 KB
testcase_04 AC 43 ms
23,436 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 45 ms
23,568 KB
testcase_09 AC 43 ms
24,384 KB
testcase_10 AC 44 ms
23,868 KB
testcase_11 AC 44 ms
24,048 KB
testcase_12 AC 43 ms
23,448 KB
testcase_13 AC 44 ms
24,372 KB
testcase_14 AC 45 ms
23,448 KB
testcase_15 AC 46 ms
23,448 KB
testcase_16 AC 45 ms
23,652 KB
testcase_17 AC 44 ms
23,412 KB
testcase_18 AC 44 ms
24,096 KB
testcase_19 AC 43 ms
23,424 KB
testcase_20 AC 44 ms
24,072 KB
testcase_21 AC 44 ms
23,436 KB
testcase_22 AC 45 ms
24,240 KB
testcase_23 AC 45 ms
23,436 KB
testcase_24 AC 44 ms
23,700 KB
testcase_25 AC 44 ms
23,604 KB
testcase_26 AC 45 ms
23,412 KB
testcase_27 AC 46 ms
24,096 KB
testcase_28 AC 46 ms
23,676 KB
testcase_29 AC 45 ms
24,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define mp make_pair
#define pb push_back
#define fi first
#define sc second

int main(int argc, char const *argv[]) {
  int n,k;
  cin >>n >>k;

  int e; //敵の入力

  if(n-1<=k){//初ターンで勝てる
    cout << n << endl;
    cout <<flush;

    cin >>e;
  }
  else{
    //初手を取るべきか否か
    bool first=true;
    if(n%(k+1)==1) first=false;

    //毎回自分の出力を割った余りはrになるようにする
    int r=n%(k+1);
    if(r==0) r=k+1;
    --r;

    cout << r << endl;
    cout <<flush;

    while(1){
      cin >>e;
      if(e>=n) break;

      int q=e/(k+1);
      int rr=e%(k+1);

      int m=e;
      if(rr<r){
        m+=r-rr;
      }
      else if(rr>r){
        m+=r+k+1-rr;
      }

      cout << m << endl;
      cout <<flush;
    }

  }

  return 0;
}
0