結果
問題 |
No.1042 愚直大学
|
ユーザー |
|
提出日時 | 2020-09-29 20:35:35 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 96 ms / 2,000 ms |
コード長 | 284 bytes |
コンパイル時間 | 201 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,544 KB |
最終ジャッジ日時 | 2024-07-04 10:50:12 |
合計ジャッジ時間 | 3,829 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
コンパイルメッセージ
Syntax OK
ソースコード
require 'bigdecimal' P, Q = gets.split.map(&:to_i) def is_ok(n) n**2 <= P + Q * n * Math.log2(n) end ok = BigDecimal(1) ng = BigDecimal(10 ** 18) DELTA = 10 ** (-6) while DELTA < ng - ok m = (ok + ng) / 2 if is_ok(m) ok = m next end ng = m end printf "%.9f\n", ok