結果
問題 |
No.347 微分と積分
|
ユーザー |
![]() |
提出日時 | 2019-08-27 20:49:02 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 435 bytes |
コンパイル時間 | 4,787 ms |
コンパイル使用メモリ | 171,520 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-17 04:56:46 |
合計ジャッジ時間 | 4,250 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
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 ((<$>), (<*>)) diff :: Double -> (Double -> Double) diff n x = n * x ** (n - 1) inte :: Double -> (Double -> Double) inte n | n == -1.0 = log | otherwise = \x -> x ** (n+1) / (n+1) main :: IO () main = do getLine b <- readLn :: IO Double as <- map (read :: String -> Double) . words <$> getLine print $ sum $ (map diff as) <*> return b print $ sum $ (map inte as) <*> return b