結果

問題 No.456 Millions of Submits!
ユーザー くれちーくれちー
提出日時 2017-03-31 08:55:27
言語 Haskell
(9.8.2)
結果
TLE  
実行時間 -
コード長 696 bytes
コンパイル時間 11,024 ms
コンパイル使用メモリ 169,420 KB
実行使用メモリ 16,272 KB
最終ジャッジ日時 2023-09-05 23:12:50
合計ジャッジ時間 10,662 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,412 KB
testcase_01 AC 3 ms
8,016 KB
testcase_02 AC 3 ms
7,980 KB
testcase_03 AC 3 ms
8,040 KB
testcase_04 AC 3 ms
7,940 KB
testcase_05 AC 5 ms
10,536 KB
testcase_06 AC 5 ms
10,552 KB
testcase_07 AC 22 ms
11,924 KB
testcase_08 AC 22 ms
11,948 KB
testcase_09 AC 112 ms
12,076 KB
testcase_10 AC 113 ms
11,932 KB
testcase_11 AC 1,042 ms
12,040 KB
testcase_12 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Control.Monad (replicateM_)
import Text.Printf (printf)

newton :: Double -> Double -> Double -> Double -> Double -> Double
newton a b t n d
    | abs d > 10e-10 = newton a b t n' d'
    | otherwise      = n'
    where
        t1 = log n
        t2 = n ** (a - 1.0)
        t3 = t1 ** (b - 1.0)
        d' = (t2 * n * t3 * t1 - t) / (t2 * t3 * (a * t1 + b))
        n' = n - d'

solve :: Double -> Double -> Double -> Double
solve a b t
    | a == 0.0  = exp (t ** (1.0 / b))
    | b == 0.0  = t ** (1.0 / a)
    | otherwise = newton a b t 2.0 114514

main = do
    m <- readLn
    replicateM_ m $ do
        [a, b, t] <- map read . words <$> getLine
        printf "%.10f\n" $ solve a b t
0