結果
問題 | No.1381 Simple Geometry 1 |
ユーザー |
![]() |
提出日時 | 2020-12-26 20:37:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 614 bytes |
コンパイル時間 | 1,519 ms |
コンパイル使用メモリ | 167,848 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-03 12:25:06 |
合計ジャッジ時間 | 2,332 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 29 |
ソースコード
//solution 1#include <bits/stdc++.h>using namespace std;using ll = long long;#define fi first#define se secondint main(){long double x,y,z,w;cin>>x>>y>>z>>w;cout<<fixed<<setprecision(10);long double minab=z,maxab=x/y;if(minab>maxab){swap(minab,maxab);}while(maxab-minab>1e-12){long double ab=(minab+maxab)/2;long double ad=x/ab;long double bp=sqrt(ab*ab+y*y),bq=sqrt(ad*ad+z*z);if(bp-bq>w){maxab=ab;}else{minab=ab;}}long double abp=(minab*y)/2,cbq=((x/minab)*z)/2,dpq=((minab-z)*(x/minab-y))/2;cout<<x-abp-cbq-dpq<<endl;}