Stars and Bars by NikNakk

a=scan("stdin")
f=function(h,d,e)
if(d<a[2])for(i in h:0)f(h-i,d+1,c(e,i))else{cat(sapply(c(e,h),function(j)paste(rep("*",j),collapse="")),sep="|");cat("\n")}
f(a[1],1,c())

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

download

return to the top page