結果

問題 No.246 質問と回答
ユーザー YOS G-specYOS G-spec
提出日時 2018-10-18 00:01:32
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 1,302 ms
コンパイル使用メモリ 132,900 KB
実行使用メモリ 24,420 KB
平均クエリ数 30.90
最終ジャッジ日時 2023-09-03 21:13:09
合計ジャッジ時間 4,074 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
23,640 KB
testcase_01 AC 37 ms
23,316 KB
testcase_02 AC 37 ms
24,180 KB
testcase_03 AC 36 ms
23,820 KB
testcase_04 AC 37 ms
23,460 KB
testcase_05 AC 35 ms
23,376 KB
testcase_06 AC 36 ms
23,616 KB
testcase_07 AC 37 ms
24,024 KB
testcase_08 AC 38 ms
24,240 KB
testcase_09 AC 37 ms
23,388 KB
testcase_10 AC 37 ms
24,216 KB
testcase_11 AC 38 ms
24,420 KB
testcase_12 AC 37 ms
23,976 KB
testcase_13 AC 36 ms
23,652 KB
testcase_14 AC 38 ms
23,988 KB
testcase_15 AC 38 ms
23,580 KB
testcase_16 AC 37 ms
24,240 KB
testcase_17 AC 38 ms
24,012 KB
testcase_18 AC 36 ms
23,988 KB
testcase_19 AC 38 ms
23,520 KB
testcase_20 AC 38 ms
23,916 KB
testcase_21 AC 37 ms
23,340 KB
testcase_22 AC 39 ms
23,640 KB
testcase_23 AC 37 ms
24,264 KB
testcase_24 AC 37 ms
24,240 KB
testcase_25 AC 37 ms
23,580 KB
testcase_26 AC 37 ms
23,604 KB
testcase_27 AC 37 ms
24,288 KB
testcase_28 AC 36 ms
23,760 KB
testcase_29 AC 37 ms
23,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;

void main(){
	auto numMin=1;
	auto numMax=1000000001;
	for(;;){
		int chkNum=(numMin+numMax)/2;
		writefln("? %d",chkNum);
		stdout.flush();
		if(readln()[0..$-1]=="1") numMin=chkNum; else numMax=chkNum;
		if(numMin==numMax-1){
			writefln("! %d",numMin);
			stdout.flush();
			break;
		}
	}
}
0