結果
| 問題 |
No.1179 Quadratic Equation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-03 18:20:08 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,113 bytes |
| コンパイル時間 | 2,048 ms |
| コンパイル使用メモリ | 193,128 KB |
| 最終ジャッジ日時 | 2025-01-15 19:25:34 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using P = pair<ll, ll>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, -1, 0, 1};
string char_to_string(char val) {
return string(1, val);
}
int char_to_int(char val) {
return val - '0';
}
char inverse_char(char c) {
if(isupper(c)) return tolower(c);
else return toupper(c);
}
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;
}
struct edge {
ll to, cost;
};
int main() {
double a, b, c; cin >> a >> b >> c;
double tmp = b * b - 4 * a * c;
if(tmp < 0) {
cout << "imaginary" << endl;
return 0;
}
double res1 = -b + sqrt(tmp); res1 /= (2 * a);
double res2 = -b - sqrt(tmp); res2 /= (2 * a);
if(res1 == res2) cout << fixed << setprecision(20) << res1 << endl;
else cout << fixed << setprecision(20) << res2 << " " << res1 << endl;
}