結果

問題 No.275 中央値を求めよ
ユーザー 情報学生情報学生
提出日時 2019-08-15 17:47:42
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 393 bytes
コンパイル時間 4,009 ms
コンパイル使用メモリ 167,540 KB
実行使用メモリ 9,276 KB
最終ジャッジ日時 2023-10-19 19:13:08
合計ジャッジ時間 4,432 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 3 ms
5,116 KB
testcase_02 AC 3 ms
5,848 KB
testcase_03 AC 3 ms
5,120 KB
testcase_04 AC 2 ms
5,124 KB
testcase_05 AC 3 ms
5,132 KB
testcase_06 AC 3 ms
5,720 KB
testcase_07 AC 6 ms
8,632 KB
testcase_08 AC 3 ms
6,224 KB
testcase_09 AC 4 ms
6,412 KB
testcase_10 WA -
testcase_11 AC 2 ms
5,112 KB
testcase_12 AC 3 ms
5,116 KB
testcase_13 AC 2 ms
5,124 KB
testcase_14 AC 2 ms
5,124 KB
testcase_15 AC 8 ms
9,272 KB
testcase_16 AC 8 ms
9,252 KB
testcase_17 AC 7 ms
9,256 KB
testcase_18 WA -
testcase_19 AC 6 ms
9,152 KB
testcase_20 AC 7 ms
9,240 KB
testcase_21 WA -
testcase_22 AC 7 ms
9,260 KB
testcase_23 AC 5 ms
8,156 KB
testcase_24 AC 4 ms
6,828 KB
testcase_25 AC 7 ms
9,264 KB
testcase_26 AC 7 ms
9,252 KB
testcase_27 AC 7 ms
9,240 KB
testcase_28 AC 3 ms
5,752 KB
testcase_29 AC 6 ms
7,828 KB
testcase_30 AC 3 ms
5,784 KB
testcase_31 AC 7 ms
9,256 KB
testcase_32 AC 4 ms
6,344 KB
testcase_33 AC 7 ms
9,252 KB
testcase_34 AC 3 ms
5,752 KB
testcase_35 AC 7 ms
9,240 KB
testcase_36 AC 6 ms
7,892 KB
testcase_37 AC 3 ms
6,312 KB
testcase_38 AC 4 ms
6,788 KB
testcase_39 AC 5 ms
7,140 KB
testcase_40 AC 8 ms
9,276 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Data.List (sort)

main :: IO ()
main = interact $ solve . sort . map read . tail . words

solve :: [Int] -> String
solve xs = if n `mod` 2 == 1 
                then show x
                else show ((x + y) `div` 2) ++ "." ++ show ((((x + y) `mod` 2) * 10) `div` 2)
    where
        n  = length xs
        ys = sort xs
        x = xs !! (n `div` 2)
        y = xs !! ((n `div` 2) - 1)
0