#include <stdio.h>
void print_fuhao(int a, int b, char c)//a fuhaoshulaing ,b konggeshuliang
{
int i;
for(i = 1; i <= b/2; i ++)
printf(" ");
for(i = 1; i <= a; i ++)
printf("%c",c);
printf("\n");
}
int main()
{
int N;
char s;
scanf("%d %c",&N,&s);
int i = 1;
int sum = 0;
//===================================
if(N%2 == 0) //even
{
while (sum <= (N/2) )
{
sum = i + sum;
i +=2;
}
}
else
{
while(sum <= (N+1)/2 )
{
sum = i + sum;
i += 2;
}
}
int cengshu;
cengshu = (i - 4)/2 + 1;
//=====================printf
int j;
for(i = 1; i <= cengshu*2 - 1; i ++)
{
if(i <= cengshu)
{
print_fuhao((cengshu+1-i)*2-1,(i-1)*2,s);
}
else
{
j = cengshu*2 - i;
print_fuhao((cengshu+1-j)*2-1,(j-1)*2,s);
}
}
//=======================the number of no use
int use_sum = 0 ;
use_sum = ((1 + (cengshu*2 -1))*cengshu/2 - 1)*2 + 1;
//=============================================
printf("%d\n",N - use_sum);
return 0;
}
|