結果

問題 No.1179 Quadratic Equation
ユーザー keisuke6keisuke6
提出日時 2022-08-26 22:52:15
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 462 bytes
コンパイル時間 1,912 ms
コンパイル使用メモリ 193,040 KB
最終ジャッジ日時 2025-01-31 05:22:39
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#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)<<' '<<max(-b*0.5/a-sqrt(b*b-4*a*c)/(2*a),-b*0.5/a+sqrt(b*b-4*a*c)/2)<<endl;
  }
}
0