結果

問題 No.306 さいたま2008
ユーザー tetsuzuki1115tetsuzuki1115
提出日時 2017-10-22 18:06:11
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 953 bytes
コンパイル時間 724 ms
コンパイル使用メモリ 79,816 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-01 10:18:01
合計ジャッジ時間 2,103 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;


int main() {
    
    double xa,ya,xb,yb;
    cin >> xa >> ya >> xb >> yb;
    
    double y1,y2;
    y1 = ya; y2 = yb;
    if ( y1 > y2 ) { swap(y1, y2); }
    
    for ( int i = 0; i < 1000000; i++ ) {
        
        double y3,y4;
        y3 = y1 + (y2-y1)/3;
        y4 = y1 + ((y2-y1)/3)*2;
        
        double dist3 = sqrt( xa*xa + (ya-y3)*(ya-y3) ) + sqrt( xb*xb + (yb-y3)*(yb-y3) );
        double dist4 = sqrt( xa*xa + (ya-y4)*(ya-y4) ) + sqrt( xb*xb + (yb-y4)*(yb-y4) );
    
        if ( dist3 > dist4 ) {
            y1 = y3;
        }
        else {
            y2 = y4;
        }
    }
    
    printf( "%.7f", y1 );
    
    
    return 0;
}
0