Created
July 23, 2018 02:02
アルゴリズムパズル 2 手袋選び
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; アルゴリズムパズル 2 | |
(defun solve-2-a (xs) | |
(1+ (apply #'+ xs))) | |
(defun solve-2-b (xs) | |
(let*( | |
(ys (sort xs #'<)) | |
(min-val (first ys)) | |
(rest-ys (rest ys))) | |
(+ (* 2 (apply #'+ rest-ys)) 1 min-val))) | |
(print (solve-2-a '(2 3 5))) | |
(print (solve-2-b '(2 3 5))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment