結果

問題 No.691 E869120 and Constructing Array 5
ユーザー lam6er
提出日時 2025-04-15 23:41:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 674 bytes
コンパイル時間 662 ms
コンパイル使用メモリ 82,520 KB
実行使用メモリ 84,080 KB
最終ジャッジ日時 2025-04-15 23:43:45
合計ジャッジ時間 14,258 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from decimal import Decimal, getcontext

getcontext().prec = 50  # High precision to handle up to 15 decimal places accurately

def solve():
    Q = int(sys.stdin.readline())
    for _ in range(Q):
        p_str = sys.stdin.readline().strip()
        p = Decimal(p_str)
        # Check if a single element works
        e_single = (p ** 2).quantize(Decimal('1'), rounding='ROUND_HALF_UP')
        error = abs(e_single.sqrt() - p)
        if error <= Decimal('1e-10'):
            print(f"1 {e_single}")
        else:
            # Use three elements as in the fourth sample
            print("3 10000000 15000000 20000000")

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