結果
問題 |
No.1064 ∪∩∩ / Cup Cap Cap
|
ユーザー |
|
提出日時 | 2020-06-24 10:09:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,663 bytes |
コンパイル時間 | 909 ms |
コンパイル使用メモリ | 101,460 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-03 20:02:25 |
合計ジャッジ時間 | 2,368 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 36 |
ソースコード
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstring> #include <fstream> #include <iostream> #include <iomanip> #include <map> #include <numeric> #include <set> #include <sstream> #include <string> #include <queue> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; const int MAX = 200007; const int MOD = 1000000007; int discriminant(long double a, long double b, long double c) { if (b*b > 4*a*c) {return 2;} else if (b*b == 4*a*c) {return 1;} else {return 0;} } long double quadratic1(long double a, long double b, long double c) { return (((-b) - sqrt(b*b - 4*a*c))/(2 * a)); } long double quadratic2(long double a, long double b, long double c) { return (((-b) + sqrt(b*b - 4*a*c))/(2 * a)); } void solve() { long double a, b, c, d; cin >> a >> b >> c >> d; if (discriminant(2, a-c, b-d) == 0) {cout << "No"; return;} if (discriminant(2, a-c, b-d) == 1) {cout << "Yes"; return;} long double res1 = quadratic1(2, a-c, b-d), res2 = quadratic2(2, a-c, b-d); pair<long double, long double> point1 = make_pair(res1, res1 * res1 + a * res1 + b); pair<long double, long double> point2 = make_pair(res2, res2 * res2 + a * res2 + b); long double slope = (point2.second - point1.second) / (point2.first - point1.first); long double yInter = point1.second - slope * point1.first; cout << fixed << setprecision(17) << slope << " " << yInter; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); //int tt; cin >> tt; for (int i = 1; i <= tt; i++) {solve(); cout << endl;} solve(); }