結果

問題 No.275 中央値を求めよ
ユーザー nobigomu
提出日時 2018-04-22 13:41:31
言語 Lua
(LuaJit 2.1.1734355927)
結果
WA  
実行時間 -
コード長 409 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 5,120 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 05:37:43
合計ジャッジ時間 1,381 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 WA * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

print((function (f, g, n, s)
	return f(g(n,s))
end)(function (n)
	return (n==math.floor(n) and "%.0f" or "%.1f"):format(n)
end, function (n, s)
	local a,rs={},bit.rshift
	for e in s:gmatch("%d+") do table.insert(a,tonumber(e)) end
	table.sort(a)
	if n==1 then return a[1] end
	if n%2~=0 then return a[rs(n,1)+1] end
	return (a[rs(n,1)]+a[rs(n,1)+1])/2
end, tonumber(io.stdin:read("*l")), io.stdin:read("*l")))
0