C(GCC),404个 389字节
#define p(x)putchar(x);
#define F for
W;S;i;a=32;b=47;c=92;f(w,s){W=w,S=s;F(;w;--w){F(i=W+w+s+1;i--;)p(a)p(b)F(i=w*2;i++-2*W;)p(a)p(c)p(10)}F(i=W+s+1;i--;)p(a)p(b)F(i=0;i++-2*W;)p(95)p(c)F(;s--+1;)p(10)F(w=W;w;--w){F(i=w;i--;)p(a)p(b)F(i=w*2;i++-2*W;)p(a)p(c)F(i=w*2+S*2;i--;)p(a)p(b)F(i=w*2;i++-2*W;)p(a)p(c)p(10)}p(b)F(i=0;i++-2*W;)p(95)p(c)F(i=S*2;i--;)p(a)p(b)F(i=0;i++-2*W;)p(95)p(c)}
在线尝试!
Rodolvertice的 -14个字节
通过修复循环变量减量来获得-1个字节
划掉404几乎还是404
取消高尔夫:
#define p(x)putchar(x); // save 7 bytes per putchar call (+24, -182)
#define F for // save 2 bytes per for loop (+14, -28)
int W, S, i; // W is w backup, S is s backup, i is an counter variable;
int a = ' '; // save 1 byte per space printed (+5, -8) (use a instead of 32)
int b = '/'; // save 1 byte per slash printed (+5, -6) (use b instead of 47)
int c = '\\'; // save 1 byte per backslash printed (+5, -6) (use c instead of 92)
// This isn't worth it for '\n' (-5, +3) (10), or '_' (-5, +3) (95)
int f(int w, int s) {
W = w; // Backup w and s, as we will modify them later,
S = s; // but will need their original values
for(; w != 0; --w) { // Top triangle (not the bottom line)
for(i = W+w+s+1; i != 0; --i) // leading spaces
putchar(' ');
putchar('/'); // left side of triangle
for(i = 2*w; i != 2*W; ++i) // inner spaces
putchar(' ');
putchar('\\'); // right side of triangle
putchar('\n'); // newline
}
for(i = W+s+1; i != 0; --i)
putchar(' '); // leading spaces for the bottom line
putchar('/'); // left side
for(i = 0; i != 2*W; ++i)
putchar('_'); // the bottom line
putchar('\\'); // right side
for(; s-- + 1 != 0;)
putchar('\n'); // newline after the bottom line and S empty lines
for(w = W; w != 0; --w) { // Bottom triangles
for(i = w; i != 0; --i)
putchar(' '); // leading spaces
putchar('/'); // left of left triangle
for(i = w*2; i != 2*W; ++i)
putchar(' '); // inside of left triangle
putchar('\\'); // right of left triangle
for(i = w*2+S*2; i != 0; --i)
putchar(' '); // spaces between left and right triangles
putchar('/');
for(i = w*2; i != 2*W; ++i)
putchar(' '); // inside of right triangle
putchar('\\'); // right of right triangle
putchar('\n'); // newline
}
putchar('//'); // left of left
for(i = 0; i != 2*W; ++i)
putchar('_'); // bottom of left triangle
putchar('\\'); // right of left
for(i = S*2; i != 0; --i)
putchar(' '); // space between triangles
putchar('/'); // left of right
for(i = 0; i != 2*W; ++i)
putchar('_'); // bottom of left triangle
putchar('\\'); // right of right
}