fork download
  1. (defun f (n m)
  2. (let* ((result (* n m))
  3. (length (1+ (length (princ-to-string result))))
  4. (kugiri (make-string length :initial-element #\-)))
  5. (format t "~@?~%x~@?~%~a~%~@?~a~% ~d~%"
  6. (format nil "~~~dd" length) n
  7. (format nil "~~~dd" (1- length)) m
  8. kugiri
  9. (format nil "~~{~~~d@a~%~~}" length)
  10. (loop for c across (nreverse (princ-to-string m))
  11. for space = 0 then (if (zerop i) space (+ space zero 1))
  12. for zero = 0 then (if (zerop i) (1+ zero) 0)
  13. for i = (* n (parse-integer (string c)))
  14. unless (zerop i)
  15. collect
  16. (concatenate 'string
  17. (princ-to-string i)
  18. (make-string zero :initial-element #\0)
  19. (make-string space :initial-element #\ )))
  20. kugiri
  21. result)))
  22.  
  23. (f 1234 1001)
  24. (f 12 1999808070605040302010)
Success #stdin #stdout 0.03s 10584KB
stdin
Standard input is empty
stdout
    1234
x   1001
--------
    1234
 123400 
--------
 1235234
                      12
x 1999808070605040302010
------------------------
                     120
                   240  
                 360    
               480      
             600        
           720          
         840            
       960              
     960                
   108                  
  108                   
 108                    
 12                     
------------------------
 23997696847260483624120