| Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 315892 | xiang | 星号三角阵(三) T2 | C++ | 解答错误 | 5 MS | 716 KB | 552 | 2026-04-14 19:58:11 |
#include <iostream> #include <string> void printRightAlignedInvertedRightTriangle(int n) { for (int i = 1; i <= n; ++i) { // 计算前置空格数,确保右对齐 std::string line(n - i, ' '); // 追加星号部分 line.append(i, '*'); // 输出整行 std::cout << line << std::endl; } } int main() { int n; std::cout << "Enter the number of rows for the inverted right triangle: "; std::cin >> n; printRightAlignedInvertedRightTriangle(n); return 0; }