結果

問題 No.275 中央値を求めよ
ユーザー apahie
提出日時 2019-04-14 17:58:58
言語 Nim
(2.2.0)
結果
RE  
実行時間 -
コード長 247 bytes
コンパイル時間 3,564 ms
コンパイル使用メモリ 65,764 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-01 23:06:38
合計ジャッジ時間 4,881 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 6 WA * 28 RE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import sequtils, strutils, algorithm

let
  n = stdin.readLine.parseInt
  a = stdin.readLine.split.map(parseInt).sorted(cmp)
var
  ans: float
  i = a.len div 2

if a.len mod 2 == 0:
  ans = (a[i] + a[i+1]) / 2
else:
  ans = a[i+1].toFloat
echo ans
0