結果
| 問題 |
No.456 Millions of Submits!
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 01:00:24 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,297 bytes |
| コンパイル時間 | 463 ms |
| コンパイル使用メモリ | 81,860 KB |
| 実行使用メモリ | 295,628 KB |
| 最終ジャッジ日時 | 2025-04-16 01:01:55 |
| 合計ジャッジ時間 | 9,462 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 WA * 8 RE * 1 TLE * 1 |
ソースコード
import math
import sys
def main():
input = sys.stdin.read().split()
idx = 0
m = int(input[idx])
idx += 1
results = []
for _ in range(m):
a = int(input[idx])
b = int(input[idx+1])
t = float(input[idx+2])
idx +=3
if a == 0:
exponent = t ** (1.0 / b)
n = math.exp(exponent)
elif b == 0:
n = t ** (1.0 / a)
else:
initial_guess = t ** (1.0 / a)
if initial_guess < 1.0:
initial_guess = 2.0
n_current = initial_guess
for _ in range(100):
ln_n = math.log(n_current)
f = (n_current ** a) * (ln_n ** b) - t
if abs(f) < 1e-15:
break
term1 = a * ln_n + b
if term1 == 0:
break
derivative = (n_current ** (a-1)) * (ln_n ** (b-1)) * term1
if derivative == 0:
break
n_new = n_current - f / derivative
if n_new <= 0:
break
n_current = n_new
n = n_current
results.append("{0:.12f}".format(n))
print('\n'.join(results))
if __name__ == '__main__':
main()
lam6er