在这里插入图片描述
#include<iostream>
#include<string>
#include<string.h>
using namespace std;
int main()
{
int T;
cin >> T;
while (T--)
{
int h, s;
char c;
cin >> h >> c >> s;
if (s == 1)
{
for (int i = 1; i <= h; i++)
{
for (int j = 1; j <= i; j++)
{
//if (j > 1)cout << ' ';
cout << c;
}
cout << endl;
}
}
else if (s == -1)
{
for (int i = 1; i <= h; i++)
{
for (int j = (h - i); j > 0; j--)
cout << ' ';
for (int j = 1; j <= i; j++)
{
//if (j > 1)cout << ' ';
cout << c; //if (j > 1)cout << ' ';
}
cout << endl;
}
}
else if(s==0)
{
for (int i = 1; i <= h; i++)
{
for (int j = 1; j <= h - i; j++)
cout << ' ';
for (int j = 1; j <= i * 2 - 1; j++)
cout << c;
//for (int j = h - i; j > 0; j--)
//cout << ' ';
cout << endl;
}
}
}
}