AIZU ONLINE JUDGEのELISP解答例(ITP1_1_A~ITP1_2_C)

ITP1_1_A:Hello World
(message "Hello World")
ITP1_1_B:X Cubic
(progn (defun cubic ()
	 (let ((x (read)))
	   (* x x x)))
       (cubic))
ITP1_1_C:Rectangle
(progn (defun rectangle ()
         (let ((a (read))
	       (b (read)))
           (cons (* a b) (* 2 (+ a b)))))
       (rectangle))
ITP1_1_D:Watch
(progn (defun watch ()
         (let ((x (read)))
           (let ((s (% x 60)))
             (let ((m (% (/ (- x s) 60) 60)))
	       (let ((h (/ (- (/ (- x s) 60) m) 60)))
	         (list h m s))))))
       (watch))
ITP1_2_A:Small, Large, or Equal
(progn (defun small ()
	 (let ((a (read))
	       (b (read)))
	   (if (< a b) (message "a<b")
	     (if (> a b) (message "a>b") (message "a=b")))))
       (small))
ITP1_2_B:Range
(progn (defun range ()
         (let ((a (read))
	       (b (read))
	       (c (read)))
           (if (and (< a b) (< b c)) (message "YES") (message "NO"))))
       (range))
ITP1_2_C:Sorting Three Numbers
(progn (defun swap (x a b)
         (let ((c (elt x a)))
           (setf (elt x a) (elt x b))
           (setf (elt x b) c)
           x))
       (defun sort ()
	 (let ((a (read)) (b (read)) (c (read)))
	   (let ((x (list a b c)))
             (dotimes (j (1- (length x)))
               (dotimes (i (1- (length x)))
                 (if (> (elt x i) (elt x (1+ i)))
	             (swap x i (1+ i)))))
	     x)))
       (sort))