def s r,d f=->a,n{[n*Math.sin(a),n*Math.cos(a)]} s=d*6 p=[] s.times{|k|p<<" "*s} c=s/2 p[c][c]=?* r.times{|a|d.times{|l|x,y=f[6.28/r*a,d*l] p[c+x.round][c+y.round]=?*}} p.map{|j|puts j} end # Test cases while i = gets a, b = i.scan(/\d+/).map(&:to_i) s a, b end
3,2 3,3 4,2 4,3 5,2 5,3 6,3 6,2 6,4
*
* *
*
*
*
* * *
*
*
*
* * *
*
*
*
* * * * *
*
*
*
*
* *
*
*
*
*
*
*
* * *
*
*
*
*
* *
* *
* * * * *
* *
* *
* *
* * *
* *
* *
* *
* *
* * * * * * *
* *
* *
* *