結果
問題 | No.306 さいたま2008 |
ユーザー |
![]() |
提出日時 | 2025-02-16 00:52:40 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 723 bytes |
コンパイル時間 | 3,059 ms |
コンパイル使用メモリ | 273,616 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-02-16 00:52:44 |
合計ジャッジ時間 | 4,196 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 26 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { int a, b, c, d; cin >> a >> b >> c >> d; cout << fixed << setprecision(15); // min sqrt(a^2 + (y - b)^2) + sqrt(c^2 + (y - d)^2) // (a, b) - (-c, d) を結ぶ直線と x = 0 の交点になれば OK // b = at + y, d = -ct + y // b - d = (a + c) t -> t = (b - d) / (a + c) // y = -at + b = (-ab + ad + ab + bc) / (a + c) = (ad + bc) / (a + c) // y = ct + d = (bc - cd + ad + cd) / (a + c) cout << (double) (a * d + b * c) / (a + c) << endl; return 0; }