結果

問題 No.450 ベー君のシャトルラン
コンテスト
ユーザー tsuchinaga
提出日時 2019-03-06 16:18:32
言語 Go
(1.27.3 + ACL)
コンパイル:
/usr/bin/go_c
実行:
./Main
結果
TLE  
実行時間 -
コード長 404 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 10,049 ms
コンパイル使用メモリ 272,788 KB
実行使用メモリ 9,908 KB
最終ジャッジ日時 2026-10-13 00:43:45
合計ジャッジ時間 16,983 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 TLE * 1 -- * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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