結果

問題 No.450 ベー君のシャトルラン
ユーザー tsuchinagatsuchinaga
提出日時 2019-03-06 16:18:32
言語 Go
(1.22.1)
結果
TLE  
実行時間 -
コード長 404 bytes
コンパイル時間 10,732 ms
コンパイル使用メモリ 202,900 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-05 19:10:16
合計ジャッジ時間 15,434 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 TLE -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"math"
)

func main() {
	var v1, v2, d1, d2, od1, od2, w float64
	_, _ = fmt.Scan(&v1, &v2, &d2, &w)
	p := math.Pow10(8)

	total := 0.0
	for {
		t := (d2 - d1) / (v2 + w)
		total += t
		od1, od2, d1, d2 = d1, d2, d1+v1*t, d2-v2*t
		// fmt.Println(t, total, d1, d2)
		if int(od1*p) == int(d1*p) && int(od2*p) == int(d2*p) {
			break
		}
	}
	fmt.Printf("%.12f\n", total*w)
}
0