結果
問題 | No.1042 愚直大学 |
ユーザー |
![]() |
提出日時 | 2025-03-20 20:21:48 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 42 ms / 2,000 ms |
コード長 | 799 bytes |
コンパイル時間 | 245 ms |
コンパイル使用メモリ | 82,044 KB |
実行使用メモリ | 54,676 KB |
最終ジャッジ日時 | 2025-03-20 20:24:07 |
合計ジャッジ時間 | 2,326 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
import mathdef find_max_n():p, q = map(int, input().split())def is_ok(n):if n < 1e-9:return False # log2(0) is undefined; minimal n consideredtry:left = n ** 2log_val = math.log2(n)right = p + q * n * log_valreturn left <= rightexcept:return False # in case n is too small, but shouldn't happen here# Find an appropriate upper boundhigh = 1.0while is_ok(high):high *= 2# Binary search between high/2 and highlow = high / 2for _ in range(1000):mid = (low + high) / 2if is_ok(mid):low = midelse:high = mid# Print with 9 decimal placesprint("{0:.9f}".format(low))find_max_n()