結果

問題 No.1793 実数当てゲーム
ユーザー simansiman
提出日時 2022-08-02 17:34:43
言語 Ruby
(3.3.0)
結果
AC  
実行時間 216 ms / 2,000 ms
コード長 365 bytes
コンパイル時間 56 ms
コンパイル使用メモリ 11,576 KB
実行使用メモリ 32,072 KB
平均クエリ数 2230.56
最終ジャッジ日時 2023-09-30 17:34:14
合計ジャッジ時間 5,307 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
30,948 KB
testcase_01 AC 114 ms
31,480 KB
testcase_02 AC 216 ms
31,456 KB
testcase_03 AC 215 ms
32,072 KB
testcase_04 AC 208 ms
31,672 KB
testcase_05 AC 202 ms
31,684 KB
testcase_06 AC 201 ms
31,164 KB
testcase_07 AC 204 ms
31,096 KB
testcase_08 AC 202 ms
30,912 KB
testcase_09 AC 203 ms
31,272 KB
testcase_10 AC 202 ms
31,212 KB
testcase_11 AC 201 ms
31,148 KB
testcase_12 AC 206 ms
31,672 KB
testcase_13 AC 211 ms
31,704 KB
testcase_14 AC 210 ms
31,396 KB
testcase_15 AC 208 ms
31,224 KB
testcase_16 AC 211 ms
31,992 KB
testcase_17 AC 206 ms
31,836 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

T = gets.to_i

def send_query(y)
  STDOUT.puts("? %.12f" % y)
  STDOUT.flush

  res = gets.chomp
  res == "Yes"
end

T.times do
  ok = 0.000001
  ng = 12.22 * 10 ** 74 + 1.0

  24.times do
    y = Math.sqrt(ok * ng)

    if send_query(y)
      ok = y
    else
      ng = y
    end
  end

  STDOUT.puts("! %.12f" % Rational(2 * ok * ng, ok + ng))
  STDOUT.flush
end
0