結果
問題 | No.450 ベー君のシャトルラン |
ユーザー | uafr_cs |
提出日時 | 2017-11-04 19:38:31 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 143 ms / 2,000 ms |
コード長 | 1,167 bytes |
コンパイル時間 | 3,221 ms |
コンパイル使用メモリ | 74,516 KB |
実行使用メモリ | 56,456 KB |
最終ジャッジ日時 | 2023-08-15 17:08:57 |
合計ジャッジ時間 | 6,455 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 139 ms
56,204 KB |
testcase_01 | AC | 140 ms
55,800 KB |
testcase_02 | AC | 139 ms
56,440 KB |
testcase_03 | AC | 139 ms
55,544 KB |
testcase_04 | AC | 139 ms
56,348 KB |
testcase_05 | AC | 138 ms
56,152 KB |
testcase_06 | AC | 140 ms
55,684 KB |
testcase_07 | AC | 141 ms
55,836 KB |
testcase_08 | AC | 141 ms
56,456 KB |
testcase_09 | AC | 138 ms
55,484 KB |
testcase_10 | AC | 140 ms
56,268 KB |
testcase_11 | AC | 139 ms
55,868 KB |
testcase_12 | AC | 138 ms
55,876 KB |
testcase_13 | AC | 140 ms
56,272 KB |
testcase_14 | AC | 142 ms
55,780 KB |
testcase_15 | AC | 143 ms
55,884 KB |
testcase_16 | AC | 143 ms
55,900 KB |
testcase_17 | AC | 142 ms
55,824 KB |
testcase_18 | AC | 142 ms
56,256 KB |
testcase_19 | AC | 140 ms
55,992 KB |
testcase_20 | AC | 140 ms
56,224 KB |
testcase_21 | AC | 142 ms
56,172 KB |
testcase_22 | AC | 140 ms
56,328 KB |
ソースコード
import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; public class Main { public static long MOD = 1000000007; public static double[] run(double d, double w, double vl, double vr){ double running = 0; final double go_right_t = d / (w + vr); running += w * go_right_t; d -= go_right_t * (vl + vr); final double go_left_t = d / (w + vl); running += w * go_left_t; d -= go_left_t * (vl + vr); return new double[]{d, running}; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); final double vl = sc.nextDouble(); final double vr = sc.nextDouble(); final double d = sc.nextDouble(); final double w = sc.nextDouble(); double[] first_try = run(d, w, vl, vr); final double second_d = first_try[0]; double[] second_try = run(second_d, w, vl, vr); final double first_run = first_try[1]; final double second_run = second_try[1]; final double rate = second_run / first_run; final double limit = first_run / (1 - rate); //System.out.println(first_run + " " + second_run + " " + rate + " " + limit); System.out.printf("%.8f\n", limit); } }