結果
問題 |
No.955 ax^2+bx+c=0
|
ユーザー |
|
提出日時 | 2019-12-20 16:44:30 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 446 bytes |
コンパイル時間 | 181 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-09-18 22:16:07 |
合計ジャッジ時間 | 5,664 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 122 |
ソースコード
#yuki955 import math import sys a,b,c=map(int,input().split()) if a==0 and b==0 and c==0: print(-1) sys.exit() if a==0 and b==0: print(0) sys.exit() if a==0: print(1) print(-c/b) sys.exit() D=b**2-4*a*c if D<0: print(0) sys.exit() if D==0: print(1) print(-b/(2*a)) sys.exit() print(2) if b<0: a,b,c=-a,-b,-c x1=(-b-math.sqrt(D))/(2*a) x2=(b**2-D)/(2*a)/(-b-math.sqrt(D)) if a>0: print(x1) print(x2) else: print(x2) print(x1)