結果

問題 No.246 質問と回答
ユーザー mbanmban
提出日時 2017-01-04 01:58:05
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 277 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 20,352 KB
実行使用メモリ 25,604 KB
平均クエリ数 31.00
最終ジャッジ日時 2024-07-16 12:09:37
合計ジャッジ時間 3,143 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:14:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |                 scanf("%d", &r);
      |                 ^~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>

int plus = 1 << 30;
int ans = 0;
int main(void) {
	int i;
	int w;
	int r;
	for (i = 0; i < 30; i++) {
		plus /= 2;
		w = ans + plus;
		printf("? %d\n", w);
		fflush(stdout);
		scanf("%d", &r);
		if (r == 0) {
			ans = w;
		}
		
	}
	printf("! %d\n", ans+1);
}
0