結果
| 問題 |
No.1042 愚直大学
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 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 math
def 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 considered
try:
left = n ** 2
log_val = math.log2(n)
right = p + q * n * log_val
return left <= right
except:
return False # in case n is too small, but shouldn't happen here
# Find an appropriate upper bound
high = 1.0
while is_ok(high):
high *= 2
# Binary search between high/2 and high
low = high / 2
for _ in range(1000):
mid = (low + high) / 2
if is_ok(mid):
low = mid
else:
high = mid
# Print with 9 decimal places
print("{0:.9f}".format(low))
find_max_n()
lam6er