結果
| 問題 | No.275 中央値を求めよ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-05-04 23:43:23 |
| 言語 | OCaml (5.5.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 1,000 ms |
| + 690µs | |
| コード長 | 430 bytes |
| 記録 | |
| コンパイル時間 | 117 ms |
| コンパイル使用メモリ | 22,528 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-09-12 07:09:58 |
| 合計ジャッジ時間 | 2,171 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
コンパイルメッセージ
ocamlfind: [WARNING] Cannot read directory ./stublibs which is mentioned in ld.conf
ソースコード
let solve n a_lst =
if n mod 2 = 1 then
List.nth a_lst (n / 2)
else
let a1 = List.nth a_lst (n / 2 - 1)
and a2 = List.nth a_lst (n / 2) in
(a1 +. a2) /. 2.
let () =
let n = read_line () |> int_of_string
and a_lst = read_line ()
|> Str.split (Str.regexp_string " ")
|> List.map float_of_string
|> List.sort compare
in
solve n a_lst
|> Printf.printf "%0.1f\n"