(defun main (&rest argv) (declare (ignorable argv)) (let* ((d (read)) (a (make-array (1+ d) :element-type 'integer)) (b 0)) (dotimes (i (1+ d)) (setf (aref a i) (read))) (loop for i from (- d 3) downto 0 do (setf (aref a (1+ i)) (+ (aref a (1+ i)) (aref a (+ i 3))) (aref a (+ 3 i)) 0)) (dotimes (i (1+ d)) (unless (zerop (aref a i)) (setq b i))) (format t "~d~%" b) (dotimes (i (1+ b)) (if (= i b) (format t "~d~%" (aref a i)) (format t "~d " (aref a i)))))) (main)