結果

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

ソースコード

diff #

import sys
from decimal import Decimal, getcontext

def main():
    getcontext().prec = 40  # Set the precision to a high enough value

    n = int(sys.stdin.readline())
    sum_sqrt = Decimal(0)
    results = []

    for _ in range(n):
        x = int(sys.stdin.readline())
        sqrt_x = Decimal(x).sqrt()
        sum_sqrt += sqrt_x
        results.append(sum_sqrt)

    # Formatting each result to 16 decimal places
    for s in results:
        # Convert to string, split into integer and decimal parts
        s_str = format(s, 'f')
        if '.' in s_str:
            integer_part, decimal_part = s_str.split('.')
            decimal_part = (decimal_part + '0' * 16)[:16]  # Pad with zeros if needed, take first 16 digits
        else:
            integer_part, decimal_part = s_str, '0' * 16
        # Ensure that the output has exactly 16 decimal places
        formatted = f"{integer_part}.{decimal_part}"
        print(formatted)

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