結果

問題 No.112 ややこしい鶴亀算
ユーザー まんしmaNNshi
提出日時 2025-04-29 19:07:46
言語 Common Lisp
(sbcl 2.5.0)
結果
WA  
実行時間 -
コード長 806 bytes
コンパイル時間 2,238 ms
コンパイル使用メモリ 27,136 KB
実行使用メモリ 19,712 KB
最終ジャッジ日時 2025-04-29 19:07:50
合計ジャッジ時間 1,628 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 29 APR 2025 07:07:46 PM):

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

ソースコード

diff #

(defparameter x (make-hash-table))


(defparameter N (parse-integer (read-line)))
(defparameter a (read-from-string (concatenate 'string "(" (read-line) ")" )))

(defparameter big 0)
(defparameter small 0)

(loop for i in a do

        (if (null (gethash i x)) (setf (gethash i x) 1) (setf (gethash i x) (+ (gethash i x) 1)))


        (if (= small 0) (setq small i)
                (if (< small i) (setq big i)
                        (if (> small i)
                                (progn (setq big small) (setq small i)))))


)

(format t "small=~d big=~d N=~d~%" small big N)

(if (or (= small 0) (= big 0))
        (if (= (/ small 4) (- N 1))
                (format t "~d ~d~%"  0 N)
                (format t "~d ~d~%"  N 0)
        )
        (format t "~d ~d~%" (gethash big x) (gethash small x))
)
0