結果

問題 No.955 ax^2+bx+c=0
ユーザー leafirbyleafirby
提出日時 2019-12-18 14:53:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 1,415 bytes
コンパイル時間 1,925 ms
コンパイル使用メモリ 194,600 KB
最終ジャッジ日時 2025-01-08 12:21:55
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 52 WA * 57 RE * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> A >> B >> C;//Ax^2+Bx+C
  if(A==B&&B==C&&A==0)Out(-1);
  else{
    L=B*B-4*A*C;
    if(L<0)Out(0);
    else{
      if(L==0){
        Out(1);
        long double r=-B/(2*A);
        HpOut(r);
      }
      else{
        Out(2);
        long double r=sqrtl(L);
        long double p=(-B+r)/(2*A);
        long double q=(-B-r)/(2*A);
        HpOut(min(p,q));
        HpOut(max(p,q));
      }
    }
  }
}
0