結果
問題 |
No.275 中央値を求めよ
|
ユーザー |
|
提出日時 | 2016-04-03 01:24:15 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 281 bytes |
コンパイル時間 | 176 ms |
コンパイル使用メモリ | 5,504 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-24 23:46:46 |
合計ジャッジ時間 | 1,335 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU n = io.read() t = {} i = 1 for c in io.read():gmatch('%S+') do t[i] = tonumber(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