結果

問題 No.456 Millions of Submits!
ユーザー 6soukiti296soukiti29
提出日時 2017-07-26 10:48:23
言語 Nim
(2.0.2)
結果
AC  
実行時間 1,332 ms / 4,500 ms
コード長 1,111 bytes
コンパイル時間 3,003 ms
コンパイル使用メモリ 70,768 KB
実行使用メモリ 4,444 KB
最終ジャッジ日時 2023-09-12 13:32:24
合計ジャッジ時間 11,974 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
4,384 KB
testcase_01 AC 24 ms
4,380 KB
testcase_02 AC 24 ms
4,376 KB
testcase_03 AC 24 ms
4,376 KB
testcase_04 AC 24 ms
4,376 KB
testcase_05 AC 24 ms
4,380 KB
testcase_06 AC 24 ms
4,380 KB
testcase_07 AC 26 ms
4,376 KB
testcase_08 AC 25 ms
4,376 KB
testcase_09 AC 38 ms
4,380 KB
testcase_10 AC 37 ms
4,376 KB
testcase_11 AC 155 ms
4,444 KB
testcase_12 AC 1,332 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sequtils,strutils,math


proc printf(formatstr: cstring)
    {.header: "<stdio.h>", varargs.}

var
    k = stdin.readline.parseInt
    a,b,t,n,p,q : float64
    ai,bi,ti : int
    slope : float64
    s : string
    kTable : array[100001,float64]
n = 30.0
t = 100.0
for i in 0..50:
    slope = ln(n)
    n = n - (p - t) / slope
    p = n * ln(n)
kTable[100000] = n
for i in 1..100000:
    t = (100000 - i).float64 / 1000
    n = kTable[100001 - i]
    p = (100001 - i).float64 / 1000
    for l in 0..3:
        slope = ln(n) + 1
        n -= (p - t) / slope
        p = n * ln(n)
    kTable[100000 - i] = n
for i in 1..k:
    (a,b,t) = stdin.readline.split.map(parseFloat)
    (ai,bi) = (a.int,b.int)
    if b == 0:
        n = pow(t, 1 / a)
    elif a == 0:
        n = exp(pow(t, 1 / b))
    else:
        ti = ceil(a / b * pow(t , 1 / b) * 1000) .int
        p = ti.float64 / 1000
        n = kTable[ti]
        q = a / b * pow(t , 1 / b)
        for l in 0..1:
            slope = ln(n) + 1
            n = n - (p - q) / slope
            p = n * ln(n)
        n = pow(n, b / a)
    printf("%.9f\n",n)
0