結果
問題 |
No.1179 Quadratic Equation
|
ユーザー |
![]() |
提出日時 | 2022-08-26 22:53:50 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 468 bytes |
コンパイル時間 | 1,972 ms |
コンパイル使用メモリ | 193,960 KB |
最終ジャッジ日時 | 2025-01-31 05:23:15 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ int a,b,c; cin>>a>>b>>c; if(4*a*c > b*b){ cout<<"imaginary"<<endl; } else if(4*a*c == b*b){ cout<<fixed<<setprecision(12); cout<<-b*0.5/a<<endl; } else{ cout<<fixed<<setprecision(12); cout<<min(-b*0.5/a-sqrt(b*b-4*a*c)/(2*a),-b*0.5/a+sqrt(b*b-4*a*c)/(2*a))<<' '<<max(-b*0.5/a-sqrt(b*b-4*a*c)/(2*a),-b*0.5/a+sqrt(b*b-4*a*c)/2/a)<<endl; } }