记个答案

输入:3
输出: A
BAB
CBABC

include <bits/stdc++.h>

using namespace std;

int main()
{
int a;
cin >> a;
for (int i = 1; i <= a; i++)
{
for (int j = 1; j <= a - i; j++)
cout << " ";
for (int j = 1; j <= 2 * i - 1; j++)
cout << char (65 + abs (i - j));
cout << endl;
}
return 0;

posted @ 2024-10-22 12:46  xiaobei_0916  阅读(4)  评论(0)    收藏  举报