結果

問題 No.246 質問と回答
ユーザー eigh8_teigh8_t
提出日時 2015-07-17 22:58:34
言語 Ruby
(3.2.2)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 212 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 11,460 KB
実行使用メモリ 31,460 KB
平均クエリ数 101.00
最終ジャッジ日時 2023-09-23 19:55:02
合計ジャッジ時間 4,992 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
31,436 KB
testcase_01 AC 104 ms
30,988 KB
testcase_02 AC 104 ms
30,668 KB
testcase_03 AC 104 ms
30,976 KB
testcase_04 AC 106 ms
30,744 KB
testcase_05 AC 104 ms
30,536 KB
testcase_06 AC 105 ms
31,176 KB
testcase_07 AC 106 ms
30,880 KB
testcase_08 AC 118 ms
30,744 KB
testcase_09 AC 114 ms
30,936 KB
testcase_10 AC 106 ms
30,756 KB
testcase_11 AC 108 ms
30,508 KB
testcase_12 AC 105 ms
30,800 KB
testcase_13 AC 105 ms
30,880 KB
testcase_14 AC 107 ms
30,860 KB
testcase_15 AC 109 ms
31,388 KB
testcase_16 AC 108 ms
31,460 KB
testcase_17 AC 104 ms
31,020 KB
testcase_18 AC 107 ms
30,860 KB
testcase_19 AC 107 ms
31,316 KB
testcase_20 AC 107 ms
30,888 KB
testcase_21 AC 112 ms
31,268 KB
testcase_22 AC 112 ms
31,328 KB
testcase_23 AC 110 ms
31,332 KB
testcase_24 AC 107 ms
31,148 KB
testcase_25 AC 107 ms
30,996 KB
testcase_26 AC 110 ms
31,420 KB
testcase_27 AC 109 ms
31,316 KB
testcase_28 AC 111 ms
31,172 KB
testcase_29 AC 110 ms
30,804 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:3: warning: assigned but unused variable - pre
Syntax OK

ソースコード

diff #

n = 500000000
d = 500000000
pre = "1\n"
100.times{
	puts "? " + n.to_s
	$stdout.flush
	d /= 2
	d = 1 if d == 0
	if gets == "1\n"
		n += d
	else
		n -= d
	end
	pre = $_
}
puts "! " + (n-$_.to_i).to_s
$stdout.flush
0