結果

問題 No.3072 Speedrun Query
ユーザー gew1fw
提出日時 2025-06-12 19:50:42
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,040 bytes
コンパイル時間 194 ms
コンパイル使用メモリ 82,156 KB
実行使用メモリ 80,380 KB
最終ジャッジ日時 2025-06-12 19:50:51
合計ジャッジ時間 5,858 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from decimal import Decimal, getcontext

getcontext().prec = 35

def main():
    n = int(sys.stdin.readline())
    xs = [int(sys.stdin.readline()) for _ in range(n)]
    
    sums = []
    current = Decimal(0)
    for x in xs:
        current += Decimal(x).sqrt()
        sums.append(current)
    
    for s in sums:
        # Convert to string with enough precision
        s_str = format(s, 'f')  # Convert to fixed-point string
        # Split into integer and fractional parts
        if '.' in s_str:
            integer_part, fractional_part = s_str.split('.')
        else:
            integer_part = s_str
            fractional_part = ''
        # Ensure fractional part has at least 18 digits
        fractional_part = fractional_part.ljust(18, '0')[:18]
        # Combine and remove trailing zeros and unnecessary decimal point
        result = f"{integer_part}.{fractional_part}"
        result = result.rstrip('0').rstrip('.') if '.' in result else result
        print(result)

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