結果

問題 No.8072 Sum of sqrt(x)
ユーザー Kiri8128
提出日時 2020-09-13 23:16:46
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 401 bytes
コンパイル時間 602 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 85,672 KB
最終ジャッジ日時 2024-06-13 04:34:25
合計ジャッジ時間 16,103 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 1
other AC * 3 RE * 1 TLE * 1 -- * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

def sqrt(n):
    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 = n // 10 ** 20, n % (10 ** 20)
    return str(a) + "." + str(b).zfill(20)

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

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