結果

問題 No.1179 Quadratic Equation
ユーザー ksukegamesksukegames
提出日時 2023-03-25 13:49:03
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 603 bytes
コンパイル時間 5,553 ms
コンパイル使用メモリ 308,540 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 00:43:51
合計ジャッジ時間 6,521 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 2 ms
4,348 KB
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define ll long long
#define rep(i,n) for (int i = 0; i < (n); i++)
#define coutf(f) cout << fixed << setprecision(f)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

int main() {
	double a, b, c;
	cin >> a >> b >> c;
	double D = b * b - 4 * a * c;
	if (D > 0) {
		coutf(10) << (-b - sqrt(D)) / (2 * a) << endl;
		coutf(10) << (-b + sqrt(D)) / (2 * a) << endl;
	}
	else if (D == 0) {
		coutf(10) << -b / (2 * a) << endl;
	}
	else {
		cout << "imaginary" << endl;
	}
	return 0;
}
0