smeghead #1007(2007/07/16 13:17 GMT) [ Common Lisp ] Rating1/1=1.00
rubikitchさんのを見てみたらparse-integerで基数指定する方が素直でした。 (print (answer))
1 2 3 4 5 6 7 8
(defun read-as-base (n base) (let ((*read-base* base)) (read-from-string (prin1-to-string n)))) (defun answer () (loop for i from 10 do (if (zerop (mod (read-as-base i 13) i)) (return i))))
Rating1/1=1.00-0+
[ reply ]
smeghead
#1007()
[
Common Lisp
]
Rating1/1=1.00
(defun read-as-base (n base) (let ((*read-base* base)) (read-from-string (prin1-to-string n)))) (defun answer () (loop for i from 10 do (if (zerop (mod (read-as-base i 13) i)) (return i))))Rating1/1=1.00-0+
[ reply ]