結果

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

ソースコード

diff #

package main

import (
	"fmt"
	"strings"
)

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

	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 od1 == d1 && od2 == d2 {
			break
		}
	}
	fmt.Println(strings.Trim(strings.Trim(fmt.Sprintf("%.12f", total*w), "0"), "."))
}
0