1036 跟奥巴马一起编程 (15 分)
#include <iostream> using namespace std; int main(){ int n, m; char ch; cin >> n >> ch; if (n % 2 == 0) // 行数的奇偶变化 m = n / 2; else m = n / 2 + 1; for (int i = 0; i < m; i++){ for (int j = 0; j < n; j++){ if (i == 0 || j == 0 || i == m - 1 || j == n - 1) //找出规律便可 cout << ch; else cout << ' '; } cout << endl; } return 0; }