Diamond Knockout by dongtits

char a[40*20],r,l,j=0,n,w,c;main(){w=getchar()-48;for(l=0;l<w;l++){for(c=0;c<w;c++){a[l*40+c]=c<w-l?c+49:(c-w-2+l<0?' ':c-w-2+l+49);}j=w;c--;while(c--){a[l*40+j++]=a[l*40+c];}a[l*40+19]=0;puts(&a[l*40]);}l--;while(l--)puts(&a[l*40]);}

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

download

return to the top page