結果
問題 | No.275 中央値を求めよ |
ユーザー | tk55513 |
提出日時 | 2020-12-21 02:01:15 |
言語 | Haskell (9.8.2) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,059 bytes |
コンパイル時間 | 5,616 ms |
コンパイル使用メモリ | 141,944 KB |
最終ジャッジ日時 | 2023-10-21 11:26:22 |
合計ジャッジ時間 | 6,186 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) Main.hs:4:1: error: Could not load module ‘Data.ByteString.Char8’ It is a member of the hidden package ‘bytestring-0.11.4.0’. You can run ‘:set -package bytestring’ to expose it. (Note: this unloads all the modules in the current scope.) Use -v (or `:set -v` in ghci) to see a list of the files searched for. | 4 | import qualified Data.ByteString.Char8 as BS | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Main.hs:5:1: error: Could not load module ‘Data.Time’ It is a member of the hidden package ‘time-1.12.2’. You can run ‘:set -package time’ to expose it. (Note: this unloads all the modules in the current scope.) Use -v (or `:set -v` in ghci) to see a list of the files searched for. | 5 | import Data.Time | ^^^^^^^^^^^^^^^^ Main.hs:6:1: error: Could not load module ‘Data.Time.Calendar’ It is a member of the hidden package ‘time-1.12.2’. You can run ‘:set -package time’ to expose it. (Note: this unloads all the modules in the current scope.) Use -v (or `:set -v` in ghci) to see a list of the files searched for. | 6 | import Data.Time.Calendar | ^^^^^^^^^^^^^^^^^^^^^^^^^
ソースコード
import Control.Monad import Data.List import Data.Maybe import qualified Data.ByteString.Char8 as BS import Data.Time import Data.Time.Calendar tuplify2 (x:y:_) = (x,y) tuplify2 _ = undefined --Input functions with ByteString readInt = fst . fromJust . BS.readInteger readIntTuple = tuplify2 . map readInt . BS.words readIntList = map readInt . BS.words getInt = readInt <$> BS.getLine getIntList = readIntList <$> BS.getLine getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine getIntMatrix = map readIntList . BS.lines <$> BS.getContents getIntTuple = readIntTuple <$> BS.getLine getIntNTuples n = map readIntTuple <$> replicateM (fromIntegral n) BS.getLine getIntTuples = map readIntTuple . BS.lines <$> BS.getContents p :: (Show a)=>a->IO () p=putStrLn.show ps=putStrLn mean::[Double]->Double mean a=(if (odd n) then (a!!n0) else (((a!!n0)+(a!!n1))/2)) where n=length a n0=div n 2 n1=(div n 2)-1 main=do n<-getInt a<-map (read::String->Double).words <$> getLine putStrLn.show$mean$sort a