fork download
  1. (loop for line = (read-line *standard-input* nil nil)
  2. while line
  3. do (let ((S (parse-integer (subseq line 0 (position #\Space line)) :junk-allowed t))
  4. (L (parse-integer (subseq line (position #\Space line)) :junk-allowed t)))
  5. (if (and (every #'integerp (list S L))
  6. (<= 1 S 10)
  7. (<= 1 L 100))
  8. (progn
  9. (format t "~%~D ~D~%" S L)
  10. (let ((P #'evenp))
  11. (dotimes (z L)
  12. (dotimes (y (if (= L 1) 1 S))
  13. (dotimes (x L)
  14. (princ (make-string S :initial-element (if (funcall P x) #\o #\x))))
  15. (terpri))
  16. (setq P (if (eq P #'evenp) #'oddp #'evenp)))))
  17. (format *error-output* "~&Invalid input: ~A~%" line))))
  18.  
Success #stdin #stdout 0.02s 10584KB
stdin
3 2
2 3
1 1
2 1
stdout
3 2
oooxxx
oooxxx
oooxxx
xxxooo
xxxooo
xxxooo

2 3
ooxxoo
ooxxoo
xxooxx
xxooxx
ooxxoo
ooxxoo

1 1
o

2 1
oo