2 条题解
-
0
#include <iostream> using namespace std; int main() { int n, x = 0; cin >> n; int a[n][n]; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { x++; a[i][j] = x; } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n / 2; j++) { swap(a[i][j], a[i][n - j + 1]); } } 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
- 189
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- 1
- 标签
- 递交数
- 87
- 已通过
- 60
- 上传者