結果
問題 |
No.955 ax^2+bx+c=0
|
ユーザー |
![]() |
提出日時 | 2023-04-16 11:37:52 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,128 bytes |
コンパイル時間 | 4,099 ms |
コンパイル使用メモリ | 250,672 KB |
最終ジャッジ日時 | 2025-02-12 09:05:22 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 WA * 35 TLE * 44 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll=long long; using ld=long double; ld pie=3.141592653589793; ll inf=144499999999994; ll mod=1000000007; int main(){ ld a,b,c; cin >> a >> b >> c; if (b*b-4*a*c>0) { cout << 2 << endl; ld left=-inf,right=-(b/(2.0*a)); while (right-left>0.0000000000001) { ld mid=(right+left)/2.0; if (a*mid*mid+b*mid+c>0) { left=mid; }else{ right=mid; } } cout << setprecision(100) << left << endl; left=-(b/(2.0*a)),right=inf; while (right-left>0.0000000000001) { ld mid=(right+left)/2.0; if (a*mid*mid+b*mid+c>0) { right=mid; }else{ left=mid; } } cout << setprecision(100) << left << endl; }else if (b*b-4*a*c==0) { cout << 1 << endl; cout << setprecision(100) << -(b/(2.0*a)) << endl; }else{ cout << 0 << endl; } }