結果

問題 No.955 ax^2+bx+c=0
ユーザー tamatotamato
提出日時 2020-02-18 00:48:33
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,159 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 82,328 KB
実行使用メモリ 81,828 KB
最終ジャッジ日時 2024-04-16 04:01:24
合計ジャッジ時間 5,892 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
59,552 KB
testcase_01 AC 39 ms
52,480 KB
testcase_02 AC 39 ms
52,864 KB
testcase_03 AC 68 ms
52,824 KB
testcase_04 AC 43 ms
52,224 KB
testcase_05 AC 43 ms
52,476 KB
testcase_06 AC 38 ms
52,864 KB
testcase_07 AC 42 ms
52,728 KB
testcase_08 AC 38 ms
53,120 KB
testcase_09 AC 39 ms
52,736 KB
testcase_10 AC 38 ms
53,120 KB
testcase_11 AC 39 ms
52,728 KB
testcase_12 AC 38 ms
52,480 KB
testcase_13 AC 39 ms
52,480 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 AC 39 ms
52,976 KB
testcase_25 AC 38 ms
54,016 KB
testcase_26 AC 38 ms
53,004 KB
testcase_27 AC 38 ms
53,740 KB
testcase_28 AC 38 ms
53,884 KB
testcase_29 AC 39 ms
53,852 KB
testcase_30 AC 38 ms
53,856 KB
testcase_31 AC 38 ms
52,728 KB
testcase_32 AC 39 ms
53,744 KB
testcase_33 AC 39 ms
53,904 KB
testcase_34 TLE -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
testcase_67 -- -
testcase_68 -- -
testcase_69 -- -
testcase_70 -- -
testcase_71 -- -
testcase_72 -- -
testcase_73 -- -
testcase_74 -- -
testcase_75 -- -
testcase_76 -- -
testcase_77 -- -
testcase_78 -- -
testcase_79 -- -
testcase_80 -- -
testcase_81 -- -
testcase_82 -- -
testcase_83 -- -
testcase_84 -- -
testcase_85 -- -
testcase_86 -- -
testcase_87 -- -
testcase_88 -- -
testcase_89 -- -
testcase_90 -- -
testcase_91 -- -
testcase_92 -- -
testcase_93 -- -
testcase_94 -- -
testcase_95 -- -
testcase_96 -- -
testcase_97 -- -
testcase_98 -- -
testcase_99 -- -
testcase_100 -- -
testcase_101 -- -
testcase_102 -- -
testcase_103 -- -
testcase_104 -- -
testcase_105 -- -
testcase_106 -- -
testcase_107 -- -
testcase_108 -- -
testcase_109 -- -
testcase_110 -- -
testcase_111 -- -
testcase_112 -- -
testcase_113 -- -
testcase_114 -- -
testcase_115 -- -
testcase_116 -- -
testcase_117 -- -
testcase_118 -- -
testcase_119 -- -
testcase_120 -- -
testcase_121 -- -
testcase_122 -- -
testcase_123 -- -
testcase_124 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    from math import sqrt
    input = sys.stdin.readline

    a, b, c = map(int, input().split())

    if a == b == c == 0:
        print(-1)
        exit()
    if a == b == 0:
        print(0)
        exit()
    if a == 0:
        print(0)
        print(-c / b)
    D = b**2 - 4*a*c
    if D < 0:
        print(0)
    elif D == 0:
        print(1)
        print(-b/(2*a))
    else:
        print(2)
        eps = 10**-11
        if a < 0:
            a *= -1
            b *= -1
            c *= -1
        L = -b / (2*a)
        ok = 10**10
        ng = L - eps
        mid = (ok+ng) / 2
        while ok - ng > eps:
            if a * mid**2 + b*mid+c > 0:
                ok = mid
            else:
                ng = mid
            mid = (ok+ng)/2
        x_plus = ok

        ok = -10 ** 10
        ng = L + eps
        mid = (ok + ng) / 2
        while ng - ok > eps:
            if a * mid ** 2 + b * mid + c > 0:
                ok = mid
            else:
                ng = mid
            mid = (ok + ng) / 2
        x_minus = ok

        print(x_minus)
        print(x_plus)


if __name__ == '__main__':
    main()
0