結果

問題 No.564 背の順
ユーザー Common Lisp
提出日時 2024-10-10 20:53:00
言語 Common Lisp
(sbcl 2.5.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 422 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 27,904 KB
実行使用メモリ 21,888 KB
最終ジャッジ日時 2024-10-10 20:53:01
合計ジャッジ時間 939 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 10 OCT 2024 08:52:59 PM):

; wrote /home/judge/data/code/Main.fasl
; compilation finished in 0:00:00.007

ソースコード

diff #

(defun main (&rest argv)
  (declare (ignorable argv))
  (let* ((h (read))
         (n (1- (read)))
         (hs (sort (loop repeat n collect (read)) #'>))
         (ans 1))
    (loop for i below n
          while (< h (elt hs i))
          do (incf ans)
          finally (princ ans))
    (case (mod ans 10)
      (1 (princ "st"))
      (2 (princ "nd"))
      (3 (princ "rd"))
      (t (princ "th")))
    (terpri)))
(main)
0