結果
問題 | No.1179 Quadratic Equation |
ユーザー |
![]() |
提出日時 | 2020-08-21 21:50:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 16 ms / 2,000 ms |
コード長 | 532 bytes |
コンパイル時間 | 4,618 ms |
コンパイル使用メモリ | 193,312 KB |
最終ジャッジ日時 | 2025-01-13 05:40:55 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define modulo 1000000007 #define mod(mod_x) ((((long long)mod_x+modulo))%modulo) #define Inf 2000000005 int main(){ int a,b,c; cin>>a>>b>>c; int D = b*b-4*a*c; if(D<0){ cout<<"imaginary"<<endl; return 0; } double ans0 = ((double)-b+sqrt(D))/((double)2.0*a); double ans1 = ans0 - 2.0 * sqrt(D)/((double)2.0*a); if(ans0>ans1)swap(ans0,ans1); if(D==0)cout<<fixed<<setprecision(10)<<ans0<<endl; else cout<<fixed<<setprecision(10)<<ans0<<' '<<ans1<<endl; return 0; }