結果
問題 |
No.955 ax^2+bx+c=0
|
ユーザー |
|
提出日時 | 2019-12-20 16:28:04 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 438 bytes |
コンパイル時間 | 620 ms |
コンパイル使用メモリ | 6,816 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-08 12:17:03 |
合計ジャッジ時間 | 4,527 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 99 WA * 23 |
ソースコード
#yuki955 import math import sys a,b,c=map(int,raw_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