結果
| 問題 |
No.1179 Quadratic Equation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-25 15:03:24 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 506 bytes |
| コンパイル時間 | 945 ms |
| コンパイル使用メモリ | 88,564 KB |
| 最終ジャッジ日時 | 2025-01-13 14:21:50 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 4 |
ソースコード
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main(){
double a, b, c;
cin >> a >> b >> c;
double d = b*b-4*a*c;
cout << fixed << setprecision(12);
if(d < 0){
cout << "imaginary" << endl;
}else if(d == 0){
cout << -b/2/a << endl;
}else{
d = sqrt(d);
double y, z;
if(-b < 0) y = (-b-d)/2/a;
else y = (-b+d)/2/a;
z = c/a/y;
cout << y << " " << z << endl;
}
return 0;
}