結果
| 問題 |
No.456 Millions of Submits!
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 00:57:58 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 3,541 ms / 4,500 ms |
| コード長 | 1,267 bytes |
| コンパイル時間 | 239 ms |
| コンパイル使用メモリ | 82,212 KB |
| 実行使用メモリ | 285,660 KB |
| 最終ジャッジ日時 | 2025-04-16 00:59:03 |
| 合計ジャッジ時間 | 7,212 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
ソースコード
import math
import sys
def main():
input = sys.stdin.read().split()
m = int(input[0])
idx = 1
for _ in range(m):
a = int(input[idx])
b = int(input[idx+1])
t = float(input[idx+2])
idx += 3
if a == 0:
inv_b = 1.0 / b
ln_n = t ** inv_b
n = math.exp(ln_n)
elif b == 0:
inv_a = 1.0 / a
n = t ** inv_a
else:
c = math.log(t)
# Find x_high by doubling until the value exceeds c
x_high = 1.0
while True:
val = a * x_high + b * math.log(x_high)
if val > c:
break
x_high *= 2
# Binary search between x_low and x_high
x_low = 1e-10
high = x_high
low = x_low
for _ in range(100):
mid = (low + high) / 2
val = a * mid + b * math.log(mid)
if val < c:
low = mid
else:
high = mid
x = (low + high) / 2
n = math.exp(x)
# Print with 12 decimal places
print("{0:.12f}".format(n))
if __name__ == "__main__":
main()
lam6er