#include<stdio.h>
#include<math.h>
int main (void)
{
int a,b=1,c,d,e,f,h;
char g;
scanf("%d %c",&a,&g);
for(;c<=a;b++){
c=pow(b,2)*2-1;}
b=b-2,d=b;    
for(f=0,e=0;d>0;d--)
{
c=d*2-1;
for(;e>0;e--)printf(" ");
for(;c>0;c--)printf("%c",g);
printf("\n");
f++,e=f;
}
for(f=b-2,e=f,d=2;d<=b;d++)
{
c=d*2-1;
for(;e>0;e--)printf(" ");
for(;c>0;c--)printf("%c",g);
printf("\n");
f--,e=f;
}
c=pow(b,2)*2-1;
h=a-c;
printf("%d",h);
return 0;
}

  运行截图: