結果

問題 No.1178 Can you draw a Circle?
ユーザー Mister
提出日時 2020-11-04 08:17:49
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 537 bytes
コンパイル時間 1,125 ms
コンパイル使用メモリ 90,056 KB
最終ジャッジ日時 2025-01-15 19:39:59
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <cmath>

using ldouble = long double;

void solve() {
    ldouble a, b, c, d, e, f;
    std::cin >> a >> b >> c >> d >> e >> f;

    e -= f;
    c /= a, d /= a, e /= a;
    // x^2 + y^2 + cx + dx + e = 0

    auto p = c / 2, q = d / 2;
    // (x+p)^2 + (y+q)^2 = r^2
    auto r = std::sqrt(p * p + q * q - e);
    std::cout << std::fixed << std::setprecision(10) << r << "\n";
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}
0