網頁

2013年11月30日 星期六

Balance partion problem

 (defun balpart (lst)
   "balace partion problem " 
   (let* ((sum (apply #'+ lst))
         (halfsum (floor (/ sum 2)) )
         (sol (make-list (+ halfsum 1) :initial-element nil )) 
         )
     (setf (first sol ) t ) 
     (dolist (i lst ) 
       (do ((j halfsum (decf j)))
          ((< j i))
        (if (nth (- j i) sol)
            (setf (nth j sol) t))))
 
     (let ( (halfcloser (do ((i halfsum (decf i) )) ((nth i sol) i ) )))
       (return-from balpart (- sum halfcloser halfcloser)))
     ))
 
 (format t "Please input a number list: ~%")
 (finish-output t ) 
 (format t "The minimum difference is : ~A~%" (balpart (read) )  )

 
詳細過程請參考此連結

2013年11月27日 星期三

ctex simsun.ttc not found 解決方法

 
網路上下載simsun.ttc後, 尋找你的texmf-local資料夾 
將simsun.ttc放入texmf-local/fonts/truetype/simsun.ttc(沒有的資料夾自己建)
最後執行texhash(sudo texhash)