Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
431706 方相宜 【C3-1】输出矩形的下三角部分 C++ 通过 100 2 MS 244 KB 765 2026-03-09 20:51:11

Tests(1/1):


#include<bits/stdc++.h> using namespace std; int a[105][105]; // 存储矩阵,范围满足题目要求 int main(){ int n; cin >> n; // 读取矩阵大小 // 第一步:读取矩阵内容(移除多余的cout<<endl) for(int i=1; i<=n; i++){ for(int j=1; j<=n; j++){ cin >> a[i][j]; } } // 第二步:输出下三角部分(处理末尾空格问题) for(int i=1; i<=n; i++){ for(int j=1; j<=i; j++){ cout << a[i][j]; // 只有不是最后一个数时,才输出空格 if(j != i){ cout << " "; } } // 每行结束后换行 cout << endl; } return 0; }


测评信息: