結果

問題 No.3072 Sum of sqrt(x)
ユーザー Kiri8128Kiri8128
提出日時 2020-09-13 23:24:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 882 ms
コンパイル使用メモリ 86,912 KB
実行使用メモリ 277,764 KB
最終ジャッジ日時 2023-09-04 00:08:57
合計ジャッジ時間 23,552 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,092 KB
testcase_01 AC 75 ms
71,348 KB
testcase_02 WA -
testcase_03 AC 74 ms
71,488 KB
testcase_04 WA -
testcase_05 AC 73 ms
71,424 KB
testcase_06 AC 74 ms
71,536 KB
testcase_07 WA -
testcase_08 AC 423 ms
269,284 KB
testcase_09 WA -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 WA -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 WA -
testcase_28 TLE -
testcase_29 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

def sqrt(n):
    if not n: return 0
    x = 1 << (n.bit_length() + 1) // 2
    y = (x + n // x) // 2
    while y < x:
        x = y
        y = (x + n // x) // 2
    return x | 1

def tostr(n):
    a, b = str(n // 10 ** 16), str(n % (10 ** 16))
    if len(a) > 15:
        return a
    return a + "." + b[:16 - len(a)]

N, *X = map(int, open(0).read().split())
s = 0
ANS = []
for x in X:
    s += sqrt(x * 10 ** 32)
    ANS.append(tostr(s))

print(*ANS, sep = "\n")
0