結果

問題 No.1179 Quadratic Equation
ユーザー uni_pythonuni_python
提出日時 2020-08-21 22:19:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 82,232 KB
実行使用メモリ 53,984 KB
最終ジャッジ日時 2024-04-23 06:03:42
合計ジャッジ時間 1,155 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,312 KB
testcase_01 AC 34 ms
52,872 KB
testcase_02 AC 34 ms
53,212 KB
testcase_03 AC 33 ms
53,172 KB
testcase_04 AC 34 ms
53,356 KB
testcase_05 AC 38 ms
52,712 KB
testcase_06 AC 33 ms
53,348 KB
testcase_07 AC 33 ms
52,920 KB
testcase_08 AC 36 ms
52,828 KB
testcase_09 AC 35 ms
53,984 KB
testcase_10 AC 34 ms
53,512 KB
testcase_11 AC 34 ms
52,264 KB
testcase_12 AC 32 ms
53,208 KB
testcase_13 AC 39 ms
53,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    a,b,c=MI()
    if a<0:
        a*=-1
        b*=-1
        c*=-1
    
    D=b*b - 4*a*c
    
    if D < 0:
        print("imaginary")
    elif D==0:
        print(-1*b/(2*a))
    else:
        ans=[]
        
        ans.append((-b-D**0.5)/(2*a))
        ans.append((-b+D**0.5)/(2*a))
        
        print(' '.join(map(str, ans)))
        
        


main()
0