結果

問題 No.306 さいたま2008
ユーザー nCk_cvnCk_cv
提出日時 2015-11-27 22:56:52
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,014 bytes
コンパイル時間 5,101 ms
コンパイル使用メモリ 74,884 KB
実行使用メモリ 58,052 KB
最終ジャッジ日時 2023-10-12 00:20:34
合計ジャッジ時間 9,538 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,852 KB
testcase_01 AC 122 ms
55,804 KB
testcase_02 AC 122 ms
55,948 KB
testcase_03 AC 126 ms
56,116 KB
testcase_04 AC 123 ms
55,976 KB
testcase_05 AC 123 ms
56,192 KB
testcase_06 AC 122 ms
55,804 KB
testcase_07 WA -
testcase_08 AC 123 ms
55,868 KB
testcase_09 AC 121 ms
56,056 KB
testcase_10 AC 125 ms
55,588 KB
testcase_11 AC 122 ms
56,004 KB
testcase_12 AC 121 ms
55,856 KB
testcase_13 AC 124 ms
55,824 KB
testcase_14 AC 123 ms
55,764 KB
testcase_15 AC 122 ms
55,596 KB
testcase_16 AC 126 ms
55,968 KB
testcase_17 AC 123 ms
55,768 KB
testcase_18 AC 122 ms
55,556 KB
testcase_19 AC 124 ms
56,052 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 124 ms
55,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.util.Map.Entry;
import java.math.*;
import java.awt.geom.*;
import java.io.*;
      
      
public class Main {	

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int xa = sc.nextInt();
		int ya = sc.nextInt();
		int xb = sc.nextInt();
		int yb = sc.nextInt();
		double yL = 0;
		double yR = 1001;
		while(yR - yL >= 0.00000001) {
			
			double yPA = ((yL + yR) / 2.0 + yR) / 2.0;
			double disAPA = Math.sqrt(Math.pow(xa, 2) + Math.pow(ya - yPA, 2));
			double disPBA = Math.sqrt(Math.pow(xb, 2) + Math.pow(yb - yPA, 2));
			double DIS2 = disAPA + disPBA;
			
			double yPB = (yL + (yL + yR) / 2.0) / 2.0;
			double disAPB= Math.sqrt(Math.pow(xa, 2) + Math.pow(ya - yPB, 2));
			double disPBB = Math.sqrt(Math.pow(xb, 2) + Math.pow(yb - yPB, 2));
			double DIS3 = disAPB + disPBB;
			
			if(DIS2 < DIS3) {
				yL = (yL + yR) / 2.0;
			}
			else {
				yR = (yL + yR) / 2.0;
			}
			
			
		}
		System.out.printf("%.20f\n",(yL + yR) / 2.0);
		
	}
	
}
0