結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
60,180 KB
testcase_01 AC 137 ms
55,860 KB
testcase_02 AC 142 ms
55,988 KB
testcase_03 AC 148 ms
55,884 KB
testcase_04 AC 137 ms
55,648 KB
testcase_05 AC 139 ms
56,560 KB
testcase_06 AC 142 ms
55,892 KB
testcase_07 AC 138 ms
56,068 KB
testcase_08 AC 137 ms
55,948 KB
testcase_09 AC 140 ms
56,060 KB
testcase_10 AC 138 ms
55,628 KB
testcase_11 AC 140 ms
55,636 KB
testcase_12 AC 138 ms
56,000 KB
testcase_13 AC 138 ms
55,884 KB
testcase_14 AC 139 ms
56,172 KB
testcase_15 AC 140 ms
55,772 KB
testcase_16 AC 139 ms
56,196 KB
testcase_17 AC 141 ms
56,064 KB
testcase_18 AC 143 ms
55,700 KB
testcase_19 AC 143 ms
55,960 KB
testcase_20 AC 142 ms
55,588 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-8){ break; }
			prev_answer = answer;
		}
		
		System.out.printf("%.8f\n", answer);
	}
}
0