#include <iostream>
using namespace std;
int sak(int z)
{
    return 1 + 4 * z + 2 * z * z;
}
int main()
{
    int x;
    char a;
    cin >> x >> a;
    //cout << x << a << endl;
    int n = 0;
    //cout << sak(n + 1) << endl;
    while(!((x >= sak(n)) && (x < sak(n + 1))))
    {
        n++;
        //cout << n << endl;
    }
    //cout << n;
    int k = n;
    int r = 0;
    for (; k != 0; k--,r++)
    {        
        int s = 2 * k + 1;
        for (int i = 0; i < r; i++)
        {
            cout << " ";
        }
        for (int j = 0; j < s; j++)
        {
            cout << a;
        }
        cout << endl;
    }
    for (int i = 0; i < r; i++)
    {
        cout << " ";
    }
    cout << a << endl;
    k++; r--;
    for (; k != n + 1; r--, k++)
    {
        int s = 2 * k + 1;
        for (int i = 0; i < r; i++)
        {
            cout << " ";
        }
        for (int j = 0; j < s; j++)
        {
            cout << a;
        }
        cout << endl;
    }

    cout << x - sak(n);
    system("pause");
    return 0;

}

posted on 2018-09-25 14:52  huaye37  阅读(160)  评论(0编辑  收藏  举报