結果
問題 | No.275 中央値を求めよ |
ユーザー |
![]() |
提出日時 | 2018-04-22 13:51:48 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 412 bytes |
コンパイル時間 | 160 ms |
コンパイル使用メモリ | 6,816 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-25 01:14:18 |
合計ジャッジ時間 | 1,280 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
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.rshiftfor e in s:gmatch("%-?%d+") do table.insert(a,tonumber(e)) endtable.sort(a)if n==1 then return a[1] endif n%2~=0 then return a[rs(n,1)+1] endreturn (a[rs(n,1)]+a[rs(n,1)+1])/2end, tonumber(io.stdin:read("*l")), io.stdin:read("*l")))