結果
問題 | No.955 ax^2+bx+c=0 |
ユーザー |
![]() |
提出日時 | 2019-12-20 23:27:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 687 bytes |
コンパイル時間 | 604 ms |
コンパイル使用メモリ | 76,912 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 02:54:33 |
合計ジャッジ時間 | 3,662 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 24 WA * 98 |
ソースコード
#include <cmath> #include <iomanip> #include <iostream> using namespace std; int main() { long long a, b, c; cin >> a >> b >> c; if (a == 0 && b == 0) { if (c == 0) cout << -1 << endl; else cout << 0 << endl; } else if (a == 0) { cout << 1 << ' ' << fixed << setprecision(15) << -c * 1.0 / b << endl; } else { long long D = b * b - 4 * a * c; if (D > 0) cout << 2 << ' ' << fixed << setprecision(15) << (-b - sqrt(D)) / (2.0 * a) << endl << (-b + sqrt(D)) / (2.0 * a) << endl; else if (D == 0) cout << 1 << ' ' << fixed << setprecision(15) << -b / (2.0 * a) << endl; else cout << 0 << endl; } }