結果
| 問題 | No.1179 Quadratic Equation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-03 23:18:18 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 482 bytes |
| 記録 | |
| コンパイル時間 | 1,498 ms |
| コンパイル使用メモリ | 166,836 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-13 17:06:00 |
| 合計ジャッジ時間 | 2,262 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
int main() {
double a, b, c;
cin >> a >> b >> c;
double d = b*b-4*a*c;
if (d < 0) {
cout << "imaginary" << endl;
return 0;
} else if (d == 0) {
cout << fixed << setprecision(10) << -b/(2*a) << endl;
} else {
cout << fixed << setprecision(10) << (-b-sqrt(d))/(2*a) << " " << (-b+sqrt(d))/(2*a) << endl;
}
}