結果
問題 | No.306 さいたま2008 |
ユーザー |
![]() |
提出日時 | 2015-11-27 23:06:56 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 828 bytes |
コンパイル時間 | 657 ms |
コンパイル使用メモリ | 88,084 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-02-14 12:09:58 |
合計ジャッジ時間 | 1,679 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 26 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <cmath> #include <algorithm> #include <cstdlib> #include <ctime> #include <cstdio> #include <functional> #include <set> #include <sstream> #include <map> #include <queue> #include <stack> #include <iomanip> using namespace std; int main(){ long double a,b,c,d; cin>>a>>b>>c>>d; cout << fixed << setprecision(16); if(a==c) cout<<(a*d+b*c)/(a+c)<<endl; else { long double p1=(a*d-b*c)/(a-c); long double p2=(a*d+b*c)/(a+c); if(p1<0.0) cout<<p2<<endl; else{ long double d1=a*a+(b-p1)*(b-p1)+c*c+(d-p1)*(d-p1); long double d2=a*a+(b-p2)*(b-p2)+c*c+(d-p2)*(d-p2); if(d1<=d2) cout<<p1<<endl; else cout<<p2<<endl; } } return 0; }