結果
問題 | No.306 さいたま2008 |
ユーザー |
![]() |
提出日時 | 2015-11-27 23:10:40 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 825 bytes |
コンパイル時間 | 292 ms |
コンパイル使用メモリ | 54,444 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-02-14 12:10:09 |
合計ジャッジ時間 | 1,240 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 26 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:21:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 21 | scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<cstdio> #include<algorithm> #include<vector> #include<cmath> using namespace std; //#define int long long typedef pair<int,int>pint; typedef vector<int>vint; #define pb push_back #define mp make_pair #define all(v) (v).begin(),(v).end() #define rep(i,n) for(int i=0;i<(n);i++) #define reps(i,f,n) for(int i=(f);i<(n);i++) template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;} template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;} int main(){ double x1,x2,y1,y2; scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2); double lb=0,ub=1000; for(int i=0;i<100;i++){ double mid=(lb+ub)/2; double x=(mid-y1)/sqrt(x1*x1+(mid-y1)*(mid-y1)) +(mid-y2)/sqrt(x2*x2+(mid-y2)*(mid-y2)); if(x<0)lb=mid; else ub=mid; } printf("%.20lf\n",ub); return 0; }