题目描述
blablabla
样例
#include <iostream>
using namespace std;
int main()
{
int a;
cin >> a;
for (int b = 1; b <= (a + 1) / 2 ;b++)
{
for (int c = 0; c < (a + 1) / 2 - b; c++)
{
cout << " ";
}
for (int d = 0; d < 2*b-1; d++)
{
cout <<"*";
}
cout << endl;
}
for (int e = 1; e <=(a-1)/2; e++)
{
for (int f = 1; f<= e; f++)
{
cout << " ";
}
for (int g = 1; g <= 2 * ((a + 1) / 2 - e) - 1; g++)
{
cout << "*";
}
cout << endl;
}
return 0;
}
算法1
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla
算法2
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla