結果
| 問題 |
No.955 ax^2+bx+c=0
|
| コンテスト | |
| ユーザー |
fuppy_kyopro
|
| 提出日時 | 2019-12-18 22:46:52 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 37 ms / 2,000 ms |
| コード長 | 829 bytes |
| コンパイル時間 | 137 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 11,136 KB |
| 最終ジャッジ日時 | 2024-09-18 22:14:56 |
| 合計ジャッジ時間 | 5,946 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 122 |
ソースコード
import math
import decimal
def main():
a, b, c = input().split()
a = decimal.Decimal(a)
b = decimal.Decimal(b)
c = decimal.Decimal(c)
if a < 0:
a, b, c = -a, -b, -c
if a == 0 and b == 0:
if c == 0:
print(-1, end='\n')
else:
print(0, end='\n')
return
if a == 0:
print(1, end='\n')
print(-c / b, end='\n')
return
t = decimal.Decimal(b * b - 4 * a * c)
if t < 0:
print(0, end='\n')
return
elif t == 0:
print(1, end='\n')
print(-b / decimal.Decimal(2 * a), end='\n')
return
t = t.sqrt()
print(2, end='\n')
print((-b - t) / decimal.Decimal(2 * a), end='\n')
print((-b + t) / decimal.Decimal(2 * a), end='\n')
if __name__ == '__main__':
main()
fuppy_kyopro