pta1

#include<stdio.h>

int main()

{

       int N,k,n,i,j,p,m,ge;

       char op;

       while(1){

              scanf("%d %c",&N,&op);

              if(N>0&&N<=1000)

                 break;

       }

       k=N-1;

       for(i=3;k>=2*i;i+=2){

              k=k-2*i;

       }

       i-=2;

       n=i;

       for(j=0;i>=1;i-=2,j++){

              for(p=0;p<j;p++)

                 printf(" ");

              for(p=0;p<i;p++)

                 printf("%c",op);

                 printf("\n");

       }

       ge=j-2;

       for(m=3;m<=n;m+=2,ge--){

              for(p=0;p<ge;p++)

              printf(" ");

              for(p=0;p<m;p++)

              printf("%c",op);

              printf("\n");

       }

       printf("%d",k);

       return 0;

}

posted @ 2019-03-02 21:21  slob·  阅读(92)  评论(0编辑  收藏  举报