結果

問題 No.275 中央値を求めよ
ユーザー HaarHaar
提出日時 2016-03-16 08:59:53
言語 Haskell
(9.8.2)
結果
AC  
実行時間 12 ms / 1,000 ms
コード長 269 bytes
コンパイル時間 791 ms
コンパイル使用メモリ 160,348 KB
実行使用メモリ 11,716 KB
最終ジャッジ日時 2023-09-07 05:15:53
合計ジャッジ時間 2,623 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,564 KB
testcase_01 AC 2 ms
7,528 KB
testcase_02 AC 3 ms
8,248 KB
testcase_03 AC 2 ms
7,492 KB
testcase_04 AC 2 ms
7,492 KB
testcase_05 AC 2 ms
7,512 KB
testcase_06 AC 4 ms
8,148 KB
testcase_07 AC 6 ms
11,260 KB
testcase_08 AC 4 ms
8,700 KB
testcase_09 AC 4 ms
8,884 KB
testcase_10 AC 4 ms
8,968 KB
testcase_11 AC 3 ms
7,352 KB
testcase_12 AC 2 ms
7,480 KB
testcase_13 AC 3 ms
7,448 KB
testcase_14 AC 3 ms
7,444 KB
testcase_15 AC 12 ms
11,612 KB
testcase_16 AC 12 ms
11,716 KB
testcase_17 AC 7 ms
11,580 KB
testcase_18 AC 5 ms
9,976 KB
testcase_19 AC 7 ms
11,556 KB
testcase_20 AC 7 ms
11,652 KB
testcase_21 AC 6 ms
10,396 KB
testcase_22 AC 12 ms
11,636 KB
testcase_23 AC 6 ms
10,700 KB
testcase_24 AC 4 ms
9,236 KB
testcase_25 AC 12 ms
11,612 KB
testcase_26 AC 12 ms
11,604 KB
testcase_27 AC 12 ms
11,652 KB
testcase_28 AC 3 ms
8,220 KB
testcase_29 AC 6 ms
10,256 KB
testcase_30 AC 3 ms
8,200 KB
testcase_31 AC 12 ms
11,560 KB
testcase_32 AC 4 ms
8,744 KB
testcase_33 AC 8 ms
11,584 KB
testcase_34 AC 3 ms
8,152 KB
testcase_35 AC 7 ms
11,676 KB
testcase_36 AC 5 ms
10,300 KB
testcase_37 AC 4 ms
8,712 KB
testcase_38 AC 5 ms
9,168 KB
testcase_39 AC 5 ms
9,564 KB
testcase_40 AC 8 ms
11,608 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )

Main.hs:4:1: warning: [GHC-94817] [-Wtabs]
    Tab character found here, and in five further locations.
    Suggested fix: Please use spaces instead.
  |
4 |                   | otherwise    = fromIntegral(xs!!(div l 2))
  | ^^^^^^^^
[2 of 2] Linking a.out

ソースコード

diff #

import Data.List
median :: [Integer] -> Float
median xs | mod l 2 == 0 = fromIntegral(xs!!(div l 2) + xs!!((div l 2)-1)) / 2
		  | otherwise    = fromIntegral(xs!!(div l 2))
		where l = length xs

main = do
	getLine
	getLine >>= print . median . sort . map read . words
0