結果
問題 |
No.3072 Speedrun Query
|
ユーザー |
![]() |
提出日時 | 2025-06-12 18:10:49 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 810 bytes |
コンパイル時間 | 1,317 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 80,768 KB |
最終ジャッジ日時 | 2025-06-12 18:12:54 |
合計ジャッジ時間 | 7,077 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 1 |
other | RE * 21 |
ソースコード
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)