結果

問題 No.1179 Quadratic Equation
ユーザー merom686
提出日時 2020-08-21 22:09:45
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 892 ms
コンパイル使用メモリ 90,040 KB
最終ジャッジ日時 2025-01-13 05:57:28
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    double a, b, c;
    cin >> a >> b >> c;

    b /= a;
    c /= a;
    b /= -2;

    double d = b * b - c;
    if (abs(d) < 1e-9) {
        printf("%.15f\n", b);
    } else if (d < 0) {
        printf("imaginary\n");
    } else {
        d = sqrt(d);
        printf("%.15f %.15f\n", b - d, b + d);
    }

    return 0;
}
0