結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
60,344 KB
testcase_01 AC 139 ms
56,028 KB
testcase_02 AC 138 ms
55,744 KB
testcase_03 AC 139 ms
56,148 KB
testcase_04 AC 140 ms
56,148 KB
testcase_05 AC 139 ms
55,952 KB
testcase_06 AC 144 ms
55,532 KB
testcase_07 AC 138 ms
56,128 KB
testcase_08 AC 138 ms
56,000 KB
testcase_09 AC 139 ms
55,956 KB
testcase_10 AC 139 ms
58,576 KB
testcase_11 AC 140 ms
55,888 KB
testcase_12 AC 139 ms
55,908 KB
testcase_13 AC 138 ms
55,964 KB
testcase_14 AC 142 ms
56,000 KB
testcase_15 AC 140 ms
56,132 KB
testcase_16 AC 138 ms
55,636 KB
testcase_17 AC 140 ms
55,904 KB
testcase_18 AC 138 ms
56,208 KB
testcase_19 AC 138 ms
55,912 KB
testcase_20 AC 140 ms
56,340 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-7){ break; }
			prev_answer = answer;
		}
		
		System.out.printf("%.8f\n", answer);
	}
}
0