結果

問題 No.550 夏休みの思い出(1)
ユーザー TatsunoTatsuno
提出日時 2017-07-28 23:10:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,069 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-18 11:33:42
合計ジャッジ時間 2,920 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 25 ms
10,880 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 28 ms
11,008 KB
testcase_05 WA -
testcase_06 AC 26 ms
10,880 KB
testcase_07 AC 29 ms
11,008 KB
testcase_08 AC 28 ms
10,880 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 AC 28 ms
11,008 KB
testcase_50 AC 24 ms
11,008 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    b,c,d = map(int, input().split())
    a = 1
    p = (3*a*c - (b**2)) / (3*(a**2))
    q = (27*(a**2)*d + 2*(b**3) - 9*a*b*c) / (27 * (a**3))
    u = ((-q/2) + (((q/2)**2 + (p/3)**3)**(1/2)))**(1/3)
    v = ((-q/2) - (((q/2)**2 + (p/3)**3)**(1/2)))**(1/3)
    w1 = (-1 + complex(3**0.5, 1)) / 2
    w2 = (-1 - complex(3**0.5, 1)) / 2
    x1 = u+v-(b/3*a)
    x2 = w1*u + w2*v -(b / 3 / a)
    x3 = w2*u + w1*v -(b / 3 / a)
    ans = list(sorted([round(x1.real), round(x2.real), round(x3.real)]))
    for i in range(-1, 2):
        y1 = ans[0] + i
        if ((y1**3) + b*(y1**2) + c*(y1) + d) != 0:
             continue
        for j in range(-1, 2):
            y2 = ans[1] + j
            if y2 <= y1: continue
            if ((y2**3) + b*(y2**2) + c*(y2) + d) != 0:
                continue
            for k in range(-1, 2):
                y3 = ans[2] + k
                if y3 <= y2: continue
                if ((y3**3) + b*(y3**2) + c*(y3) + d) != 0:
                    continue
                print(y1, y2, y3)
                return
solve()
0