結果

問題 No.450 ベー君のシャトルラン
ユーザー uafr_csuafr_cs
提出日時 2017-11-04 19:22:02
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 770 bytes
コンパイル時間 2,166 ms
コンパイル使用メモリ 71,756 KB
実行使用メモリ 60,552 KB
最終ジャッジ日時 2023-08-15 17:09:32
合計ジャッジ時間 9,263 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
60,552 KB
testcase_01 AC 139 ms
56,560 KB
testcase_02 AC 140 ms
55,852 KB
testcase_03 AC 139 ms
56,468 KB
testcase_04 AC 139 ms
56,256 KB
testcase_05 AC 139 ms
56,572 KB
testcase_06 AC 139 ms
55,828 KB
testcase_07 AC 137 ms
55,916 KB
testcase_08 AC 138 ms
56,100 KB
testcase_09 AC 137 ms
55,924 KB
testcase_10 AC 137 ms
55,856 KB
testcase_11 AC 138 ms
55,896 KB
testcase_12 AC 140 ms
56,232 KB
testcase_13 AC 140 ms
56,440 KB
testcase_14 AC 138 ms
55,920 KB
testcase_15 AC 137 ms
56,228 KB
testcase_16 AC 140 ms
55,960 KB
testcase_17 AC 138 ms
55,912 KB
testcase_18 AC 141 ms
56,100 KB
testcase_19 AC 139 ms
56,052 KB
testcase_20 AC 140 ms
56,216 KB
testcase_21 TLE -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	
	public static long MOD = 1000000007;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final double vl = sc.nextDouble();
		final double vr = sc.nextDouble();
		
		double d = sc.nextDouble();
		final double w = sc.nextDouble();
		
		double prev_answer = 0, answer = 0;
		while(true){
			final double go_right_t = d / (w + vr);
			answer += w * go_right_t;
			d -= go_right_t * (vl + vr);
			
			final double go_left_t = d / (w + vl);
			answer += w * go_left_t;
			d -= go_left_t * (vl + vr);
			
			if(Math.abs(prev_answer - answer) <= 1e-6){ break; }
			prev_answer = answer;
		}
		
		System.out.printf("%.8f\n", answer);
	}
}
0