結果

問題 No.306 さいたま2008
ユーザー nCk_cvnCk_cv
提出日時 2015-11-27 23:00:06
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,030 bytes
コンパイル時間 3,601 ms
コンパイル使用メモリ 75,240 KB
実行使用メモリ 60,384 KB
最終ジャッジ日時 2023-10-12 00:23:41
合計ジャッジ時間 9,100 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
60,384 KB
testcase_01 AC 128 ms
55,808 KB
testcase_02 AC 127 ms
54,068 KB
testcase_03 AC 129 ms
56,072 KB
testcase_04 AC 128 ms
55,836 KB
testcase_05 AC 126 ms
56,288 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

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 = 2000;
		while(Math.abs(yR - yL) >= 0.00000000000001) {
			
			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