結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー kk
提出日時 2020-08-26 12:29:36
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 687 bytes
コンパイル時間 1,955 ms
コンパイル使用メモリ 197,640 KB
実行使用メモリ 24,468 KB
平均クエリ数 9.37
最終ジャッジ日時 2023-09-24 06:29:19
合計ジャッジ時間 5,950 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
23,460 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 43 ms
23,376 KB
testcase_05 AC 44 ms
24,300 KB
testcase_06 AC 44 ms
23,412 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 45 ms
23,484 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 44 ms
23,676 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()

const double PI = acos(-1);

void say(long long x) {
  cout << x << endl;
  cout.flush();
}

long long rcv(long long n) {
  long long t;
  cin >> t;
  if (t >= n)
    exit(0);
  return t;
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  long long n, k;
  cin >> n >> k;

  long long cur = 1;
  long long ng = n % (k+1);
  if (ng = cur) {
    say(0);
    cur = rcv(n);
  }

  while (1) {
    while (ng <= cur)
      ng += k+1;
    say(ng-1);
    cur = rcv(n);
  }
  
  return 0;
}
0