結果
問題 | No.1179 Quadratic Equation |
ユーザー |
![]() |
提出日時 | 2020-08-21 22:33:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 532 bytes |
コンパイル時間 | 1,870 ms |
コンパイル使用メモリ | 165,700 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 05:59:22 |
合計ジャッジ時間 | 2,271 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 2 |
ソースコード
#include <bits/stdc++.h> #define INF 2000000000000000000 #define ll long long using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll a, b, c; cin >> a >> b >> c; ll D = b * b - 4 * a * c; if (D < 0) { cout << "imaginary" << "\n"; } else if (D == 0) { double ans = -b; ans /= 2 * a; cout << ans << "\n"; } else { double ans = -b - pow(D, 0.5); ans /= 2 * a; cout << ans << " "; ans = -b + pow(D, 0.5); ans /= 2 * a; cout << ans << "\n"; } }