結果

問題 No.594 壊れた宝物発見機
ユーザー letrangerjpletrangerjp
提出日時 2017-11-11 00:00:26
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 311 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 11,248 KB
実行使用メモリ 31,500 KB
平均クエリ数 47.10
最終ジャッジ日時 2023-09-23 14:59:43
合計ジャッジ時間 5,071 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 174 ms
30,724 KB
testcase_01 AC 174 ms
30,852 KB
testcase_02 AC 180 ms
31,344 KB
testcase_03 AC 170 ms
30,640 KB
testcase_04 AC 179 ms
31,288 KB
testcase_05 AC 175 ms
31,096 KB
testcase_06 AC 176 ms
31,248 KB
testcase_07 AC 175 ms
30,580 KB
testcase_08 AC 171 ms
30,796 KB
testcase_09 AC 179 ms
30,680 KB
testcase_10 AC 177 ms
30,828 KB
testcase_11 AC 177 ms
30,924 KB
testcase_12 AC 173 ms
31,336 KB
testcase_13 AC 174 ms
30,824 KB
testcase_14 AC 172 ms
31,056 KB
testcase_15 AC 168 ms
31,160 KB
testcase_16 AC 174 ms
31,208 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 175 ms
31,396 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

$>.sync = true

def f(n, l=-100, r=100)
  if (l-r).abs <= 1
    return r
  end
  a = [0]*3
  a[n] = l
  puts"? #{a*' '}"
  lv = gets.to_i
  a[n] = r
  puts"? #{a*' '}"
  rv = gets.to_i
  c = (l+r)/2
  if lv > rv
    f(n, c, r)
  else
    f(n, l, c)
  end
end

x = f(0)
y = f(1)
z = f(2)
puts "! #{x} #{y} #{z}"
0