提交时间:2026-01-04 15:24:53

运行 ID: 80634

#include <iostream> using namespace std; int main() { int height, width, solid; char ch; cin >> height >> width >> ch >> solid; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { if (solid == 1) { // 实心:全部输出字符 cout << ch; } else { // 空心:判断是否在边界上 if (i == 0 || i == height - 1 || j == 0 || j == width - 1) { cout << ch; } else { cout << ' '; // 内部填充空格 } } } cout << endl; // 每行结束换行 } return 0; }