結果
問題 | No.275 中央値を求めよ |
ユーザー |
![]() |
提出日時 | 2016-12-11 22:39:08 |
言語 | Vim script (v9.1) |
結果 |
AC
|
実行時間 | 12 ms / 1,000 ms |
コード長 | 606 bytes |
コンパイル時間 | 89 ms |
コンパイル使用メモリ | 6,816 KB |
実行使用メモリ | 12,032 KB |
最終ジャッジ日時 | 2024-06-25 00:09:18 |
合計ジャッジ時間 | 2,697 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
function! s:output()let this = {'lines': []}function! this.append(line) abortcall add(self.lines, a:line)endfunctionfunction! this.build() abortreturn join(self.lines, "\n")endfunctionreturn thisendfunctionfunction! s:main(input) abortlet o = s:output()let a_list = map(split(a:input[1], ' '), 'str2nr(v:val)')call sort(a_list, 'f')let left = (len(a_list) - 1) / 2let right = len(a_list) / 2let r = (a_list[left] + a_list[right]) / 2.0call o.append(r)return o.build()endfunctionlet s:input = getline(1, '$')enewput =s:main(s:input)2,$print