結果

問題 No.450 ベー君のシャトルラン
ユーザー tsuchinaga
提出日時 2019-03-06 16:18:32
言語 Go
(1.23.4)
結果
TLE  
実行時間 -
コード長 404 bytes
コンパイル時間 12,242 ms
コンパイル使用メモリ 234,120 KB
実行使用メモリ 13,884 KB
最終ジャッジ日時 2024-06-23 14:36:47
合計ジャッジ時間 14,339 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 TLE * 1 -- * 1
権限があれば一括ダウンロードができます

ソースコード

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