文章目录
- AcWing 753. 平方矩阵 I
- AC代码
AcWing 753. 平方矩阵 I
本题链接:AcWing 753. 平方矩阵 I
本博客给出本题截图:
AC代码
代码:
#include <iostream> using namespace std; int main() { int n; while (cin >> n, n) { for (int i = 1; i <= n; i ++ ) { for (int j = 1; j <= n; j ++ ) { int up = i, down = n - i + 1, left = j, right = n - j + 1; cout << min(min(up, down), min(left, right)) << ' '; } cout << endl; } cout << endl; } return 0; }