結果

問題 No.456 Millions of Submits!
ユーザー lam6er
提出日時 2025-03-20 20:28:06
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,314 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 82,368 KB
実行使用メモリ 293,848 KB
最終ジャッジ日時 2025-03-20 20:29:21
合計ジャッジ時間 10,957 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import sys

def main():
    input = sys.stdin.read().split()
    ptr = 0
    m = int(input[ptr])
    ptr += 1
    for _ in range(m):
        a = int(input[ptr])
        b = int(input[ptr+1])
        t = float(input[ptr+2])
        ptr +=3
        
        if a == 0:
            exponent = t ** (1.0 / b)
            n = math.exp(exponent)
        elif b == 0:
            n = t ** (1.0 / a)
        else:
            # Binary search for n^a * (ln n)^b = t
            def compute(n_val):
                log_val = math.log(n_val)
                pow_log = log_val ** b
                pow_n = n_val ** a
                return pow_n * pow_log
            
            # Find high
            high = 2.0
            while compute(high) < t:
                high *= 2
            low = high / 2
            
            # Binary search with enough iterations
            for _ in range(100):
                mid = (low + high) * 0.5
                current = compute(mid)
                if current < t:
                    low = mid
                else:
                    high = mid
            n = high  # After sufficient iterations, high is the best approximation
        
        # Output up to 12 decimal places
        print("{0:.12f}".format(n))
        
if __name__ == "__main__":
    main()
0