結果
問題 |
No.1179 Quadratic Equation
|
ユーザー |
![]() |
提出日時 | 2020-08-21 23:07:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 607 bytes |
コンパイル時間 | 3,083 ms |
コンパイル使用メモリ | 193,808 KB |
最終ジャッジ日時 | 2025-01-13 06:34:00 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 2 |
ソースコード
#define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; #include <bits/stdc++.h> using namespace std; int main() { ll a,b,c; cin>>a>>b>>c; ll d=b*b-4*a*c; double e=sqrt((double)d); if(d<0){ cout<<"imaginary"<<endl; } else if(d==0){ cout<<fixed<<setprecision(10)<<-(double)b/2/a<<endl; } else{ if(b>=0){ double x=(-b-e)/2/a; cout<<fixed<<setprecision(10)<<x<<" "<<c/x/a<<endl; } else{ double x=(-b+e)/2/a; cout<<fixed<<setprecision(10)<<c/x/a<<" "<<x<<endl; } } return 0; }