結果
問題 | No.1381 Simple Geometry 1 |
ユーザー |
|
提出日時 | 2021-02-07 20:44:34 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 764 bytes |
コンパイル時間 | 767 ms |
コンパイル使用メモリ | 90,080 KB |
最終ジャッジ日時 | 2025-01-18 13:56:54 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 29 |
ソースコード
#line 1 "main.cpp" #include <iostream> #include <iomanip> #include <cmath> using namespace std; using ldouble = long double; void solve() { ldouble x, y, z, d; cin >> x >> y >> z >> d; ldouble lt = z, gt = x / y; for (int q = 0; q < 100; ++q) { auto h = (lt + gt) / 2; auto w = x / h; auto bp = sqrt(h * h + y * y), bq = sqrt(w * w + z * z); if (bp > bq + d) { gt = h; } else { lt = h; } } auto h = lt; auto w = x / h; auto ans = x - (h * y + z * w + (h - z) * (w - y)) / 2; cout << ans << "\n"; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); solve(); return 0; }