程序代码:
#include <cstdio>
int main( void )
{
const size_t n = 8;
for( size_t i=0,j=0; i!=(2*n+1)*(2*n+4); ++i )
{
size_t r = i/(2*n+4);
size_t c = i%(2*n+4);
if( c+1 == 2*n+4 )
putchar( '\n' );
else if( r+c<=n || r+(2*n+2-c)<=n || (2*n-r)+c<=n || (2*n-r)+(2*n+2-c)<=n )
putchar( '+' );
else
putchar( 'A'+(j++%26) );
}
return 0;
}
输出:
+++++++++A+++++++++
++++++++BCD++++++++
+++++++EFGHI+++++++
++++++JKLMNOP++++++
+++++QRSTUVWXY+++++
++++ZABCDEFGHIJ++++
+++KLMNOPQRSTUVW+++
++XYZABCDEFGHIJKL++
+MNOPQRSTUVWXYZABC+
++DEFGHIJKLMNOPQR++
+++STUVWXYZABCDE+++
++++FGHIJKLMNOP++++
+++++QRSTUVWXY+++++
++++++ZABCDEF++++++
+++++++GHIJK+++++++
++++++++LMN++++++++
+++++++++O+++++++++