2 条题解
-
1
#include <iostream> using namespace std; int main() { int n; cin >> n; int a[n + 1][n + 1]; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { a[i][j] = max(i, j); } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { cout << " " << a[i][j]; } cout << endl; } return 0; }
-
0
#include <bits/stdc++.h> using namespace std; int n; int a[100][100]; int main() { cin >> n; for (int i = 1; i <= n; i++) { int x=i; for (int j = 1; j <= n; j++) { if (j< x) { a[i][j] =x;
} else{ a[i][j] =x; x++; } } } for (int i = 1; i <=n ; i++) { for (int j = 1; j <= n; j++) { cout << setw(3) << a[i][j]; } cout << endl; } return 0;
}
- 1
信息
- ID
- 199
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- 1
- 标签
- 递交数
- 46
- 已通过
- 43
- 上传者