結果

問題 No.246 質問と回答
コンテスト
ユーザー くれちー
提出日時 2016-12-27 16:14:56
言語 C90(gcc15)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 287 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 162 ms
コンパイル使用メモリ 35,256 KB
最終ジャッジ日時 2026-02-24 00:00:57
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>

int main() {
	int top = 1, tail = 1e9, b;
	
	while (1) {
		printf("? %d\n", (top + tail) / 2);
		fflush(stdout);
		scanf("%d", &b);
		if (b) top = (top + tail) / 2;
		else tail = (top + tail) / 2;
		if (top == tail - 1) break;
	}

	printf("! %d\n", top);
	return 0;
}
0