結果

問題 No.3072 Speedrun Query
ユーザー gew1fw
提出日時 2025-06-12 14:47:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 756 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 82,240 KB
実行使用メモリ 184,496 KB
最終ジャッジ日時 2025-06-12 14:50:46
合計ジャッジ時間 5,518 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 2 TLE * 1 -- * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

from decimal import Decimal, getcontext
import sys

def main():
    # Set high precision to ensure accuracy
    getcontext().prec = 40  # Sufficient for 1e-15 precision

    # Read all input at once for efficiency
    data = sys.stdin.read().split()
    n = int(data[0])
    x_list = data[1:n+1]

    # Precompute square roots and sums
    current_sum = Decimal(0)
    sums = []
    for xi_str in x_list:
        xi = Decimal(xi_str)
        sqrt_xi = xi.sqrt()
        current_sum += sqrt_xi
        sums.append(current_sum)

    # Format each sum for output
    for s in sums:
        s_str = format(s, 'f').rstrip('0').rstrip('.') if '.' in str(s) else str(s)
        print(s_str if '.' in s_str else s_str + '.0')

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