結果

問題 No.275 中央値を求めよ
ユーザー Leonardone
提出日時 2016-04-03 01:21:41
言語 Lua
(LuaJit 2.1.1734355927)
結果
WA  
実行時間 -
コード長 271 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 6,816 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-02 12:32:29
合計ジャッジ時間 1,256 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 WA * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

-- yukicoder My Practice
-- author: Leonardone @ NEETSDKASU

n = io.read()

t = {}
i = 1
for c in io.read():gmatch('%d+') do
	t[i] = c
	i = i + 1
end

table.sort(t)

if n % 2 == 0 then
	x = n / 2
	print((t[x] + t[x + 1]) / 2)
else
	x = math.ceil(n / 2)
	print(t[x])
end

0