結果

問題 No.3072 Speedrun Query
ユーザー gew1fw
提出日時 2025-06-12 18:10:02
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 704 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 82,028 KB
実行使用メモリ 67,332 KB
最終ジャッジ日時 2025-06-12 18:12:09
合計ジャッジ時間 3,319 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import sys

def main():
    n = int(sys.stdin.readline())
    x = [int(sys.stdin.readline()) for _ in range(n)]
    
    sum_total = 0.0
    compensation = 0.0
    
    for xi in x:
        term = math.sqrt(xi)
        # Kahan summation steps
        y = term - compensation
        t = sum_total + y
        compensation = (t - sum_total) - y
        sum_total = t
        
        # Formatting the output
        s = "{0:.17f}".format(sum_total)
        integer_part, decimal_part = s.split('.')
        decimal_part = decimal_part.rstrip('0')
        if not decimal_part:
            decimal_part = '0'
        print(f"{integer_part}.{decimal_part}")

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