fork download
  1. module Main where
  2.  
  3. import Control.Monad
  4. import System.Environment
  5.  
  6. -- 摂取したいカロリーに必要な炊く前の白米の重量を計算
  7. calPerGram = (*) $ 1 / (2.2 * 1.68)
  8.  
  9. --
  10. -- 値段と全重量、接種したいカロリーをひきすうにして、接種したいカロリーあたりの価格を計算
  11. pricePerGram price amount targetCal = (price :: Double) / times
  12. where
  13. amount' = amount * 1000
  14. times = amount' / calPerGram targetCal
  15.  
  16.  
  17.  
  18.  
  19. main = do
  20. (p:a:t:_) <- getLine >>= return . map (read :: String -> Double) . words
  21. print . round . pricePerGram p a $ t
  22.  
  23.  
  24.  
Success #stdin #stdout 0s 6316KB
stdin
3500 10 300
stdout
28