結果
問題 | No.955 ax^2+bx+c=0 |
ユーザー |
![]() |
提出日時 | 2019-12-18 00:18:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,141 bytes |
コンパイル時間 | 1,351 ms |
コンパイル使用メモリ | 169,272 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-06 23:40:53 |
合計ジャッジ時間 | 5,177 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 42 WA * 66 RE * 14 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<long long,long long> pll; #define ep emplace_back #define pb push_back #define mp make_pair #define rep(i,n) for(int i=0;i<(n);++i) constexpr int mod=1000000007; constexpr int mod1=998244353; vector<int> dx={0,1,0,-1},dy={-1,0,1,0}; bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; } template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true; } return false; } int main(){ cin.tie(0); ios::sync_with_stdio(false); ll a,b,c;cin >> a >> b >> c; if(b * b - 4 * a * c < 0){ cout << 0 << endl; return 0; } if(b * b - 4 * a * c == 0){ cout << 1 << endl; cout << setprecision(20) << fixed << -b / (2 * a) << endl; return 0; } double ans1 = (double)(-b + sqrt(b * b - 4 * a * c)) / (double)(2 * a), ans2 = (double)(-b - sqrt(b * b - 4 * a * c)) / (double)(2 * a); cout << 2 << endl; cout << setprecision(20) << fixed << ans2 << endl << ans1 << endl; }