結果
問題 |
No.955 ax^2+bx+c=0
|
ユーザー |
![]() |
提出日時 | 2019-12-18 12:53:57 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,326 bytes |
コンパイル時間 | 745 ms |
コンパイル使用メモリ | 85,320 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-07 00:41:38 |
合計ジャッジ時間 | 2,913 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 89 WA * 33 |
ソースコード
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<bitset> #include<set> #include<map> #include<stack> #include<queue> #include<deque> #include<list> #include<iomanip> #include<cmath> #include<cstring> #include<functional> using namespace std; #define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) repr(i, 0, n) #define INF 2e9 //#define MOD 1000000007 #define MOD 998244353 #define LINF (long long)4e18 #define jck 3.141592 using ll = long long; using Pi = pair<int,int>; using Pl = pair<ll,ll>; int main(){ cout << fixed << setprecision(15); ll a,b,c; cin >> a >> b >> c; if(a == 0 && b == 0 && c == 0){ cout << -1 << endl; return 0; } if(a == 0 && b == 0 && c != 0){ cout << 0 << endl; return 0; } if(a == 0 && b != 0){ cout << 1 << endl; cout << (double)(-c)/b << endl; return 0; } if(b*b-4*a*c == 0){ cout << 1 << endl; cout << (double)(-b)/(2*a) << endl; } else if(b*b-4*a*c < 0){ cout << 0 << endl; } else{ cout << 2 << endl; double ans1 = ((double)(-b)+sqrt(b*b-4*a*c))/(2*a); double ans2 = ((double)(-b)-sqrt(b*b-4*a*c))/(2*a); cout << ans2 << endl; cout << ans1 << endl; } }