Zigzag by uru

n=gets.to_i
s=$:.map{" "*$$}
i=-1
((("1"*n).to_i**2/10).to_s.split(//).map(&:to_i)*n).map{|b|s[b][i+=1]=$_[2]}
1.upto(n){|i|puts s[i][0..2*n*n-4*n+i+1]}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top