結果

問題 No.955 ax^2+bx+c=0
ユーザー maspymaspy
提出日時 2020-02-05 21:25:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 675 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 11,920 KB
実行使用メモリ 10,212 KB
最終ジャッジ日時 2023-10-24 07:25:43
合計ジャッジ時間 9,449 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

def solve(a,b,c):
    if a == b == c == 0:
        return -1, []
    elif a == b == 0:
        return 0, []
    elif a == 0:
        return 1, [-c / b]
    D = b * b - 4 * a * c
    if D < 0:
        return 0, []
    elif D == 0:
        return 1, [-b / (a+a)]
    if b < 0:
        a,b,c = -a,-b,-c
    sqD = D ** .5
    alpha = (-b - sqD) / (a + a)
    prod = c / a
    beta = prod / alpha
    return 2, sorted([alpha, beta])

n, nums = solve(a,b,c)
if n == -1:
    print(-1)
else:
    print(n)
    print(*nums, sep='\n')
0