結果
| 問題 |
No.450 ベー君のシャトルラン
|
| コンテスト | |
| ユーザー |
Ysmr_Ry
|
| 提出日時 | 2016-12-17 03:51:28 |
| 言語 | Haskell (9.10.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 508 bytes |
| コンパイル時間 | 12,182 ms |
| コンパイル使用メモリ | 172,928 KB |
| 実行使用メモリ | 820,388 KB |
| 最終ジャッジ日時 | 2024-12-14 04:12:39 |
| 合計ジャッジ時間 | 19,111 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 TLE * 1 MLE * 1 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
import Control.Applicative
import Control.Monad.State
main :: IO ()
main = do
[vl,vr] <- map read . words <$> getLine :: IO [Double]
d <- readLn :: IO Double
w <- readLn :: IO Double
print $ evalState (simulate vl vr w) (0,d)
simulate :: Double -> Double -> Double -> State (Double, Double) Double
simulate vl vr w = do
(dist, d) <- get
let t1 = d/(w+vr)
t2 = t1+(d-(vl+vr)*t1)/(w+vl)
put $ (dist+w*t2, d-(vl+vr)*t2)
if abs d < 0.000001
then return dist
else simulate vl vr w
Ysmr_Ry