結果
| 問題 | No.275 中央値を求めよ |
| コンテスト | |
| ユーザー |
Common Lisp
|
| 提出日時 | 2024-10-09 12:34:30 |
| 言語 | Common Lisp (sbcl 2.6.3) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 1,000 ms |
| コード長 | 296 bytes |
| 記録 | |
| コンパイル時間 | 249 ms |
| コンパイル使用メモリ | 30,208 KB |
| 実行使用メモリ | 22,272 KB |
| 最終ジャッジ日時 | 2026-04-25 15:43:22 |
| 合計ジャッジ時間 | 1,988 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 25 APR 2026 03:43:19 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.091
ソースコード
; 中央値を求める
(defun main ()
(let* ((n (read))
(m (floor (1- n) 2))
(xs (sort (loop repeat n collect (read)) #'<))
(ans (if (evenp n)
(/ (+ (elt xs m) (elt xs (1+ m))) 2d0)
(elt xs m))))
(format t "~f~%" ans)))
(main)
Common Lisp