結果

問題 No.275 中央値を求めよ
ユーザー Michae'Gon
提出日時 2017-02-28 18:07:29
言語 F#
(F# 4.0)
結果
AC  
実行時間 78 ms / 1,000 ms
コード長 278 bytes
コンパイル時間 8,475 ms
コンパイル使用メモリ 185,428 KB
実行使用メモリ 32,256 KB
最終ジャッジ日時 2024-06-25 00:23:41
合計ジャッジ時間 12,411 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (228 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

module Main
open System

let n = Console.ReadLine() |> int
let xs = Console.ReadLine().Split(' ')
        |> Array.map float
        |> Array.sort

Console.WriteLine(
    if n % 2 = 0 then
        let i =  n / 2
        (xs.[i] + xs.[i - 1]) / 2.0
    else
        xs.[n / 2]
)
0