题解
题解:
注意“行数是列数的50%(四舍五入)”
1 #include2 using namespace std; 3 int main() 4 { 5 int n; 6 char c; 7 cin >> n >> c; 8 int n1; 9 if (n % 2 == 0)10 n1 = n / 2 - 2;11 else12 n1 = n / 2 - 1;13 for (int i = 0; i < n; i++)14 {15 cout << c;16 }17 cout << endl;18 for (int i = 0; i < n1; i++)19 {20 cout << c;21 for (int j = 0; j < (n - 2); j++)22 {23 cout << " ";24 }25 cout << c;26 cout << endl;27 }28 for (int i = 0; i < n; i++)29 {30 cout << c;31 }32 cout << endl;33 return 0;34 }