题解 | 字符圣诞树
字符圣诞树
https://www.nowcoder.com/practice/0fae60c3b5c64699b7c0f031c2187dde
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
string c;
cin>>c;
for(int i=0;i<5;++i)
{
for(int j = 4-i;j>0;--j )
{
cout<<" ";
}
for(int j=0;j<=i;++j)
{
cout<<c<<" ";
}
cout<<endl;
}
return 0;
}
// 1
// 1 1
// 1 1 1
// 1 1 1 1
// 1 1 1 1 1