Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
113822 | 彭士宝 | 打印沙漏 | C++ | Wrong Answer | 1 MS | 268 KB | 782 | 2025-03-16 16:39:29 |
#include <iostream> #include <string> using namespace std; int main() { int n; char symbol; cin >> n >> symbol; // 上半部分 for (int i = 0; i < n; ++i) { // 打印前导空格 for (int j = 0; j < i; ++j) { cout << " "; } // 打印符号 for (int j = 0; j < 2 * (n - i) - 1; ++j) { cout << symbol; } cout << endl; } // 下半部分 for (int i = n - 2; i >= 0; --i) { // 打印前导空格 for (int j = 0; j < i; ++j) { cout << " "; } // 打印符号 for (int j = 0; j < 2 * (n - i) - 1; ++j) { cout << symbol; } cout << endl; } return 0; }
------Input------
3
------Answer-----
***** *** * *** *****
------Your output-----