結果

問題 No.306 さいたま2008
ユーザー latte0119latte0119
提出日時 2015-11-27 22:55:07
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 882 bytes
コンパイル時間 1,150 ms
コンパイル使用メモリ 144,052 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 00:17:31
合計ジャッジ時間 2,174 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 2 ms
4,352 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 1 ms
4,352 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 1 ms
4,352 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
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;}

typedef complex<double>Point;

Point get(){
    double x,y;
    scanf("%lf%lf",&x,&y);
    return Point(x,y);
}

int main(){
    Point A,B;
    A=get();B=get();

    double lb=0,ub=1000;

    for(int i=0;i<1000;i++){
        double m1=(lb*2+ub)/3,m2=(lb+ub*2)/3;
        Point p1(0,m1),p2(0,m2);
        double d1=abs(A-p1)+abs(B-p1);
        double d2=abs(A-p2)+abs(B-p2);
        if(d1+(1e-12)>d2)lb=m1;
        else ub=m2;
    }

    printf("%.20lf\n",ub);
    return 0;
}
0