結果
問題 |
No.691 E869120 and Constructing Array 5
|
ユーザー |
![]() |
提出日時 | 2025-06-12 19:10:05 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 830 bytes |
コンパイル時間 | 268 ms |
コンパイル使用メモリ | 82,168 KB |
実行使用メモリ | 71,780 KB |
最終ジャッジ日時 | 2025-06-12 19:10:39 |
合計ジャッジ時間 | 6,135 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 27 |
ソースコード
import math Q = int(input()) for _ in range(Q): P_str = input().strip() P = float(P_str) # Try single term e_single = P ** 2 e_single_rounded = round(e_single) if abs(math.sqrt(e_single_rounded) - P) <= 1e-10: print(1, e_single_rounded) continue # Try three terms with multipliers 1, 1.5, 2 S = 1 + math.sqrt(1.5) + math.sqrt(2) e_base = (P / S) ** 2 e_base_rounded = round(e_base) sum_test = math.sqrt(e_base_rounded) + math.sqrt(1.5 * e_base_rounded) + math.sqrt(2 * e_base_rounded) if abs(sum_test - P) <= 1e-10: print(3, int(e_base_rounded), int(1.5 * e_base_rounded), int(2 * e_base_rounded)) continue # Fallback: use single term with e_base_rounded (though not exact, but for demonstration) print(1, int(e_base_rounded))