fork(1) download
  1. def s r,d
  2. f=->a,n{[n*Math.sin(a),n*Math.cos(a)]}
  3. s=d*6
  4. p=[]
  5. s.times{|k|p<<" "*s}
  6. c=s/2
  7. p[c][c]=?*
  8. r.times{|a|d.times{|l|x,y=f[6.28/r*a,d*l]
  9. p[c+x.round][c+y.round]=?*}}
  10. p.map{|j|puts j}
  11. end
  12.  
  13. # Test cases
  14.  
  15. while i = gets
  16. a, b = i.scan(/\d+/).map(&:to_i)
  17. s a, b
  18. end
  19.  
  20.  
Success #stdin #stdout 0s 4760KB
stdin
3,2 3,3 4,2 4,3 5,2 5,3 6,3 6,2 6,4
stdout
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *