結果

問題 No.1064 ∪∩∩ / Cup Cap Cap
ユーザー veqcc
提出日時 2020-05-29 22:04:24
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 927 bytes
コンパイル時間 1,046 ms
コンパイル使用メモリ 104,648 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-06 04:47:16
合計ジャッジ時間 2,245 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

int main() {
    double a, b, c, d;
    cin >> a >> b >> c >> d;

    double D = (a - c) * (a - c) - 8 * (b - d);
    if (D < 0) {
        cout << "No" << endl;
    } else if (D == 0) {
        cout << "Yes" << endl;
    } else {
        D /= 4.0;
        double x1 = ((c - a) / 2.0 + sqrt(D)) / 2.0;
        double x2 = ((c - a) / 2.0 - sqrt(D)) / 2.0;
        double y1 = x1 * x1 + a * x1 + b;
        double y2 = x2 * x2 + a * x2 + b;
        double p = (y2 - y1) / (x2 - x1);
        double q = y1 - p * x1;
        cout << fixed << setprecision(8) << p << ' ' << q << endl;
    }

    return 0;}
0