题目链接:https://pintia.cn/problem-sets/994805260223102976/problems/994805285812551680
题解:
1 #include<iostream> 2 using namespace std; 3 4 int main() { 5 int n; 6 char c; 7 cin >> n >> c; 8 for (int i = 0; i < (n + 1) / 2; i++) { 9 if (i == 0 || i == (n + 1) / 2 - 1) 10 for (int j = 0; j < n; j++) 11 cout << c; 12 else { 13 cout << c; 14 for (int j = 1; j < n - 1; j++) 15 cout << " "; 16 cout << c; 17 } 18 cout << endl; 19 } 20 return 0; 21 }