結果
問題 |
No.955 ax^2+bx+c=0
|
ユーザー |
![]() |
提出日時 | 2020-04-17 21:09:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 649 bytes |
コンパイル時間 | 1,690 ms |
コンパイル使用メモリ | 166,872 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-03 10:42:34 |
合計ジャッジ時間 | 4,508 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 89 WA * 33 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long using ld=long double; signed main(){ int a,b,c;cin>>a>>b>>c; if(!a){ if(!b){ if(!c)cout<<-1<<endl; else cout<<0<<endl; } else{ cout<<1<<endl; cout<<fixed<<setprecision(12)<<(ld)(-c)/b<<endl; } return 0; } if(b*b-4*a*c>0){ cout<<2<<endl; cout<<fixed<<setprecision(12)<<(-b-sqrt(b*b-4*a*c))/(2*a)<<endl; cout<<fixed<<setprecision(12)<<(-b+sqrt(b*b-4*a*c))/(2*a)<<endl; } if(b*b-4*a*c==0){ cout<<1<<endl; cout<<fixed<<setprecision(12)<<(ld)(-b)/(2*a)<<endl; } if(b*b-4*a*c<0){ cout<<0<<endl; } }