/*
one: 画图,找规律,能发现这是两个三角形的头搞到一起,如果以单个三角形的
层数做基准t,所需点数为22^2-1 -1是因为头少了一个哈哈
two: 第一步用while循环看看是符合基准t为多少的沙漏2 * pow(t, 2) - 1随着t增大看看啥时候就大于等于
给定的n了 所以确定了t 然后也就知道超出的数量n-nn
three: 分上下链各个部分输出
上部分规律是 t,t层倒三角,空格的数量从0到t-1 星星的数量从2t-1到1 先输出空格在输出星星
下部分看着倒着输出
*/
#include<iostream>
#include<string>
#include<math.h>
#include<iomanip>
using namespace std;
int main()
{
char s;
int n, nn = 0, t = 1;; //nn 做要用的 t做小层数
cin >> n>>s;
while (nn <= n)
{
nn = 2 * pow(t, 2) - 1;
t++;
}
t-=2;
nn = 2 * pow(t, 2) - 1;
//cout << t<<endl;
for (int i = t; i > 0; i--)
{
for (int j = 0; j < t - i; j++) cout << " ";
for (int j = 0; j < 2 * i - 1; j++) { cout << s; }
cout << endl;
}
for (int i = 2; i <= t; i++)
{
for (int j = 0; j < t - i; j++) cout << " ";
for (int j = 0; j < 2 * i - 1; j++) cout << s;
cout << endl;
}
cout << n - nn;
return 0;
}