結果

問題 No.275 中央値を求めよ
ユーザー Hirotaka OhkuboHirotaka Ohkubo
提出日時 2016-07-15 16:24:25
言語 Haskell
(9.8.2)
結果
AC  
実行時間 12 ms / 1,000 ms
コード長 227 bytes
コンパイル時間 5,108 ms
コンパイル使用メモリ 157,916 KB
実行使用メモリ 11,804 KB
最終ジャッジ日時 2023-09-07 05:26:51
合計ジャッジ時間 2,861 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,552 KB
testcase_01 AC 3 ms
7,496 KB
testcase_02 AC 3 ms
8,252 KB
testcase_03 AC 3 ms
7,504 KB
testcase_04 AC 3 ms
7,492 KB
testcase_05 AC 2 ms
7,532 KB
testcase_06 AC 3 ms
8,188 KB
testcase_07 AC 6 ms
11,188 KB
testcase_08 AC 4 ms
8,744 KB
testcase_09 AC 4 ms
8,920 KB
testcase_10 AC 4 ms
8,996 KB
testcase_11 AC 3 ms
7,472 KB
testcase_12 AC 3 ms
7,444 KB
testcase_13 AC 2 ms
7,376 KB
testcase_14 AC 3 ms
7,328 KB
testcase_15 AC 12 ms
11,628 KB
testcase_16 AC 12 ms
11,648 KB
testcase_17 AC 7 ms
11,664 KB
testcase_18 AC 5 ms
9,948 KB
testcase_19 AC 7 ms
11,632 KB
testcase_20 AC 12 ms
11,616 KB
testcase_21 AC 5 ms
10,332 KB
testcase_22 AC 8 ms
11,612 KB
testcase_23 AC 6 ms
10,724 KB
testcase_24 AC 5 ms
9,296 KB
testcase_25 AC 12 ms
11,804 KB
testcase_26 AC 8 ms
11,600 KB
testcase_27 AC 7 ms
11,736 KB
testcase_28 AC 3 ms
8,224 KB
testcase_29 AC 6 ms
10,340 KB
testcase_30 AC 3 ms
8,180 KB
testcase_31 AC 7 ms
11,616 KB
testcase_32 AC 4 ms
8,820 KB
testcase_33 AC 8 ms
11,652 KB
testcase_34 AC 3 ms
8,204 KB
testcase_35 AC 7 ms
11,596 KB
testcase_36 AC 6 ms
10,488 KB
testcase_37 AC 4 ms
8,808 KB
testcase_38 AC 5 ms
9,340 KB
testcase_39 AC 5 ms
9,640 KB
testcase_40 AC 12 ms
11,644 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 )
[2 of 2] Linking a.out

ソースコード

diff #

import Data.List

main = do
  getLine
  li <- getLine
  let ns = sort $ map read $ words li
  print $ compute ns

compute ns
  | odd (length ns) = ns !! l2
  | True = (ns !! (l2-1) + ns !! l2) / 2
  where l2 = div (length ns) 2
0