結果

問題 No.3072 Speedrun Query
ユーザー gew1fw
提出日時 2025-06-12 18:16:39
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 810 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 82,652 KB
実行使用メモリ 80,656 KB
最終ジャッジ日時 2025-06-12 18:17:15
合計ジャッジ時間 4,052 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from decimal import Decimal, getcontext, ROUND_HALF_UP

getcontext().prec = 35  # Sufficient precision to handle up to 1e6 terms

n = int(sys.stdin.readline())
current_sum = Decimal(0)
for _ in range(n):
    x_str = sys.stdin.readline().strip()
    x = Decimal(x_str)
    sqrt_x = x.sqrt()
    current_sum += sqrt_x
    # Round to 17 decimal places using quantize
    rounded = current_sum.quantize(Decimal('1.00000000000000000'), rounding=ROUND_HALF_UP)
    # Convert to string and ensure exactly 17 decimal digits
    s = format(rounded, 'f')
    if '.' in s:
        integer_part, fractional_part = s.split('.')
        fractional_part = fractional_part.ljust(17, '0')[:17]
        formatted = f"{integer_part}.{fractional_part}"
    else:
        formatted = f"{s}.{'0'*17}"
    print(formatted)
0