結果

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

ソースコード

diff #

from decimal import Decimal, getcontext

getcontext().prec = 30  # Set precision high enough to handle sqrt accurately

n = int(input())
sum_so_far = Decimal(0)

for _ in range(n):
    x = int(input())
    xi = Decimal(x)
    sqrt_x = xi.sqrt()
    sum_so_far += sqrt_x
    
    # Format the sum to have exactly 17 decimal places
    s = format(sum_so_far, 'f')  # Convert to fixed-point string
    if '.' in s:
        integer_part, fractional_part = s.split('.')
        fractional_part = fractional_part.ljust(17, '0')[:17]
    else:
        integer_part = s
        fractional_part = '0' * 17
    formatted = f"{integer_part}.{fractional_part}"
    print(formatted)
0