Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
109797 汤奕硕 拐角方阵 C++ Wrong Answer 1 MS 268 KB 620 2025-02-11 18:54:51

Tests(0/2):


Code:

#include <iostream> #include <algorithm> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { // 计算当前位置所在的层数 int d1 = i; int d2 = j; int d3 = (n - 1 - i); int d4 = (n - 1 - j); int layer = min(d1, min(d2, min(d3, d4))) + 1; if (j > 0) { cout << " "; // 第一个数字前不加空格 } cout << layer; } cout << endl; // 换行 } return 0; }


Run Info:

------Input------
5
------Answer-----
1 1 1 1 1 1 2 2 2 2 1 2 3 3 3 1 2 3 4 4 1 2 3 4 5
------Your output-----
1 1 1 1 1 1 2 2 2 1 1 2 3 2 1 1 2 2 2 1 1 1 1 1 1