lisp lang solution №2 update

This commit is contained in:
Дмитрий Голондарев 2026-03-28 23:19:11 +03:00
parent 43bdd6f1b4
commit b4279293b4
2 changed files with 4 additions and 4 deletions

View file

@ -45,7 +45,7 @@ exec ros -Q -- "$0" "$@"
(type (integer 0 62) len)) (type (integer 0 62) len))
(let* ((total-combinations (let* ((total-combinations
(1- (ash 1 (the (integer 0 61) (- len 1)))))) (1- (ash 1 (the (integer 0 62) len)))))
(declare (type fixnum total-combinations)) (declare (type fixnum total-combinations))
(format t "~D~%" total-combinations) (format t "~D~%" total-combinations)
(loop for i from 0 to total-combinations do (loop for i from 0 to total-combinations do
@ -60,7 +60,7 @@ exec ros -Q -- "$0" "$@"
(format t "ER: input parameters~%") (format t "ER: input parameters~%")
(uiop:quit 1)) (uiop:quit 1))
(progn (progn
(let* ((len (length args)) (let* ((len (- (length args) 1))
(target (parse-integer (first args))) (target (parse-integer (first args)))
(mask (make-array len :element-type 'fixnum :initial-element 0)) (mask (make-array len :element-type 'fixnum :initial-element 0))
(numbers (coerce (mapcar #'parse-integer (rest args)) '(simple-array fixnum (*))))) (numbers (coerce (mapcar #'parse-integer (rest args)) '(simple-array fixnum (*)))))

View file

@ -31,7 +31,7 @@
(type (integer 0 62) len)) (type (integer 0 62) len))
(let* ((total-combinations (let* ((total-combinations
(1- (ash 1 (the (integer 0 61) (- len 1)))))) (1- (ash 1 (the (integer 0 62) len 1)))))
(declare (type fixnum total-combinations)) (declare (type fixnum total-combinations))
(format t "~D~%" total-combinations) (format t "~D~%" total-combinations)
(loop for i from 0 to total-combinations do (loop for i from 0 to total-combinations do
@ -46,7 +46,7 @@
(format t "ER: input parameters~%") (format t "ER: input parameters~%")
(uiop:quit 1)) (uiop:quit 1))
(progn (progn
(let* ((len (length args)) (let* ((len (- (length args) 1))
(target (parse-integer (first args))) (target (parse-integer (first args)))
(mask (make-array len :element-type 'fixnum :initial-element 0)) (mask (make-array len :element-type 'fixnum :initial-element 0))
(numbers (coerce (mapcar #'parse-integer (rest args)) '(simple-array fixnum (*))))) (numbers (coerce (mapcar #'parse-integer (rest args)) '(simple-array fixnum (*)))))