#include<iostream>
#include<math.h>
#include<string>
using namespace std;
int main()
{
int n;
char t;
cin >> n >> t;
int b = round((n*1.0) / 2);
for (int i = 1; i <= b; i++)
{
if (i == 1 || i == b) //第一行和最后一行全为字符t
for (int j = 0; j < n; j++)
cout << t;
else
{
for (int j = 1; j <= n; j++)
{
if (j == 1 || j == n) //每行第一个字符和最后一个为t
cout << t;
else
cout << " ";
}
}
cout << endl;
}
system("pause");
return 0;
}
PAT 乙级 1036 跟奥巴马一起编程 (15分)
最新推荐文章于 2021-08-13 15:47:40 发布