結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,500 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 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 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"
	"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