結果
| 問題 |
No.955 ax^2+bx+c=0
|
| コンテスト | |
| ユーザー |
iqueue02
|
| 提出日時 | 2019-12-18 00:46:18 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 676 bytes |
| コンパイル時間 | 1,380 ms |
| コンパイル使用メモリ | 167,372 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-07 00:00:40 |
| 合計ジャッジ時間 | 3,651 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 63 WA * 59 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
int main(){
std::cout<<std::fixed<<std::setprecision(18);
long double a, b, c;
cin >> a >> b >> c;
long double D = b * b - 4 * a * c;
if (D < 0) {
cout << 0 << endl;
return 0;
}
long double x1 = (-b - (b < 0 ? -1 : 1) * sqrt(D)) / 2 * a;
long double x2 = c / (a * x1);
if (D == 0) {
cout << 1 << endl;
cout << (-b + sqrt(D)) / (2 * a) << endl;
} else {
cout << 2 << endl;
if (x1 > x2) swap(x1, x2);
cout << x1 << endl;
cout << x2 << endl;
}
return 0;
}
iqueue02