結果
問題 | No.550 夏休みの思い出(1) |
ユーザー |
![]() |
提出日時 | 2017-07-28 23:53:17 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 563 bytes |
コンパイル時間 | 98 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-10-10 06:54:14 |
合計ジャッジ時間 | 3,301 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 53 RE * 2 |
ソースコード
# にぶたんで解を1つ見つける # その解をsとすると、x^3+ax+bx+c=(x-s)(x^2+(a+s)x+-c/s)となるので、2次方程式の解の公式へ。 import math a, b, c = map(int, input().split()) l = -10**9 r = 10**9 for i in range(100): m = (l + r) / 2.0 if m**3 + a * m**2 + b * m + c > 0: r = m else: l = m s = (l + r) / 2.0 d = a + s e = -c / s t = (-d + math.sqrt(d * d - 4 * e)) / 2.0 u = (-d - math.sqrt(d * d - 4 * e)) / 2.0 x = list({s, t, u}) x.sort() for i in x: print(int(i + 10**-9 if i > 0 else i - 10**-9))