結果

問題 No.3011 あ、俺こいつの役やりたい!
ユーザー tnakao0123
提出日時 2025-01-28 14:23:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 472 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 39,808 KB
実行使用メモリ 26,344 KB
平均クエリ数 11.61
最終ジャッジ日時 2025-01-28 14:23:09
合計ジャッジ時間 3,744 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 44
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:25:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   25 |     scanf("%d", &r);
      |     ~~~~~^~~~~~~~~~

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 3011.cc:  No.3011 縺ゅ€∽ソコ縺薙>縺、縺ョ蠖ケ繧・j縺溘>! - yukicoder
 */

#include<cstdio>
#include<algorithm>

using namespace std;

/* constant */

const int MAX_N = 1000000000;

/* main */

int main() {
  int x = MAX_N;

  for (;;) {
    x = (x + 1) / 2;
    printf("%d\n", x); fflush(stdout);
    
    int r;
    scanf("%d", &r);
    if (r != 0) break;
  }

  for (int i = 0; i < 1000000000; i++);
  return 0;
}
0