結果
問題 | No.275 中央値を求めよ |
ユーザー |
![]() |
提出日時 | 2017-05-04 16:23:25 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 7 ms / 1,000 ms |
コード長 | 452 bytes |
コンパイル時間 | 9,211 ms |
コンパイル使用メモリ | 171,904 KB |
実行使用メモリ | 8,320 KB |
最終ジャッジ日時 | 2024-06-25 00:29:25 |
合計ジャッジ時間 | 3,248 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
コンパイルメッセージ
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
ソースコード
importPreludeimportData.Listsort,genericLengthmain::IO()main = don <- read <$> getLineas <- map read . words <$> getLineprint $ calc n ascalc::Int->Int->Floatcalc n as = let as' = sort asin if odd n then fromIntegral $ as' !! div n 2else average $ take 2 $ drop (div n 2 - 1) as'average::RealaFractionalb=>a->baverage is = realToFrac (sum is) / genericLength is