| Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 89069 | sh25_zhangyj | 写个“2” | C++ | 通过 | 0 MS | 248 KB | 592 | 2026-05-22 15:07:57 |
#include <iostream> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { if (i == 0 || i == n - 1) { // 第一行和最后一行:全是星号 for (int j = 0; j < n; j++) { cout << "*"; } } else { // 中间行:前面输出空格,最后输出一个星号,形成斜线 for (int j = 0; j < n - 1 - i; j++) { cout << " "; } cout << "*"; } cout << endl; } return 0; }