結果

問題 No.450 ベー君のシャトルラン
ユーザー uafr_csuafr_cs
提出日時 2017-11-04 19:21:39
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 770 bytes
コンパイル時間 1,886 ms
コンパイル使用メモリ 75,680 KB
実行使用メモリ 61,040 KB
最終ジャッジ日時 2024-05-03 04:04:48
合計ジャッジ時間 8,307 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
60,604 KB
testcase_01 AC 116 ms
54,472 KB
testcase_02 AC 124 ms
53,848 KB
testcase_03 AC 115 ms
53,800 KB
testcase_04 AC 124 ms
54,152 KB
testcase_05 AC 136 ms
54,268 KB
testcase_06 AC 114 ms
53,668 KB
testcase_07 AC 128 ms
54,212 KB
testcase_08 AC 130 ms
54,256 KB
testcase_09 AC 123 ms
53,940 KB
testcase_10 AC 112 ms
53,592 KB
testcase_11 AC 129 ms
54,428 KB
testcase_12 AC 128 ms
54,352 KB
testcase_13 AC 119 ms
53,584 KB
testcase_14 AC 130 ms
54,576 KB
testcase_15 AC 128 ms
54,244 KB
testcase_16 AC 129 ms
54,224 KB
testcase_17 AC 129 ms
54,372 KB
testcase_18 AC 128 ms
54,216 KB
testcase_19 AC 127 ms
54,228 KB
testcase_20 AC 117 ms
53,528 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