結果

問題 No.955 ax^2+bx+c=0
ユーザー beet
提出日時 2020-04-17 20:26:57
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 785 bytes
コンパイル時間 2,425 ms
コンパイル使用メモリ 194,736 KB
最終ジャッジ日時 2025-01-09 19:36:01
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 46 WA * 76
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}


struct Precision{
  Precision(){
    cout<<fixed<<setprecision(12);
  }
}precision_beet;

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  Int a,b,c;
  cin>>a>>b>>c;

  using D = long double;
  if(b*b-4*a*c<0) drop(0);
  if(b*b-4*a*c==0){
    cout<<1<<newl;
    cout<<D(-b)/D(2*a)<<newl;
    return 0;
  }
  cout<<2<<newl;
  cout<<(D(-b)-sqrt(D(b*b-4*a*c)))/D(2*a)<<newl;
  cout<<(D(-b)+sqrt(D(b*b-4*a*c)))/D(2*a)<<newl;
  return 0;
}
0