2 条题解
-
3
编写不难 难在找规律
已AC,放心食用
#include <iostream> using namespace std; int main() { int n; cin >> n; int a[n][n]; for (int i = 1;i <= n;++i){ int x = n; int f = i; if (i == 1){ for (int j = 1;j <= n;++j){ a[i][j] = f; f += x; x --; } } else{ for (int j = 1;j <= i - 1;++j){ a[i][j] = a[j][i]; } for (int j = i;j <= n;++j){ a[i][j] = f; f += x; x --; } } } for (int i = 1;i <= n;++i){ for (int j = 1;j <= n;++j){ if (a[i][j] / 10 > 0){ cout << " " << a[i][j]; } else{ cout << " " << a[i][j]; } } cout << endl; } return 0; }
好像UI变了 注释写不上
-
0
#include <iostream> using namespace std; int main() { int n; cin >> n; int a[n][n]; for (int i = 1;i <= n;++i){ int x = n; int f = i; if (i == 1){ for (int j = 1;j <= n;++j){ a[i][j] = f; f += x; x --; } } else{ for (int j = 1;j <= i - 1;++j){ a[i][j] = a[j][i]; } for (int j = i;j <= n;++j){ a[i][j] = f; f += x; x --; } } } for (int i = 1;i <= n;++i){ for (int j = 1;j <= n;++j){ if (a[i][j] / 10 > 0){ cout << " " << a[i][j]; } else{ cout << " " << a[i][j]; } } cout << endl; } return 0; }
- 1
信息
- ID
- 401
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- 2
- 标签
- 递交数
- 39
- 已通过
- 25
- 上传者