結果
| 問題 |
No.3072 Speedrun Query
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 18:14:29 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 810 bytes |
| コンパイル時間 | 197 ms |
| コンパイル使用メモリ | 82,324 KB |
| 実行使用メモリ | 80,640 KB |
| 最終ジャッジ日時 | 2025-06-12 18:15:23 |
| 合計ジャッジ時間 | 4,196 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)
gew1fw