結果

問題 No.456 Millions of Submits!
ユーザー lam6er
提出日時 2025-04-16 00:58:10
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,609 bytes
コンパイル時間 495 ms
コンパイル使用メモリ 81,716 KB
実行使用メモリ 320,984 KB
最終ジャッジ日時 2025-04-16 00:59:13
合計ジャッジ時間 9,065 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
    results = []
    for _ in range(m):
        a = int(input[ptr])
        b = int(input[ptr+1])
        t = float(input[ptr+2])
        ptr +=3
        
        if a == 0:
            tb = t ** (1.0 / b)
            n = math.exp(tb)
        elif b == 0:
            n = t ** (1.0 / a)
        else:
            # Define the function to compute n^a (ln n)^b
            def f(n_val):
                try:
                    log_n = math.log(n_val)
                except:
                    return float('inf')
                log_pow = log_n ** b
                if log_pow == 0:
                    return 0.0
                n_pow = n_val ** a
                return n_pow * log_pow
            
            # Find upper bound
            low = 1.0
            high = 1.0
            while True:
                current = f(high)
                if current > t:
                    break
                high *= 2
            
            # Binary search
            eps = 1e-15
            for _ in range(100):
                mid = (low + high) * 0.5
                val = f(mid)
                if val < t:
                    low = mid
                else:
                    high = mid
                if high - low < eps:
                    break
            n = (low + high) * 0.5
        
        # Format to 12 decimal places
        results.append("{0:.12f}".format(n))
    
    # Output all results
    print('\n'.join(results))

if __name__ == "__main__":
    main()
0