From 1e169a02c8d20805dbab8348f49cb763299ede34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98Carl?= Date: Tue, 4 Jan 2022 23:06:12 +0800 Subject: [PATCH] =?UTF-8?q?Update=200054.=E8=9E=BA=E6=97=8B=E7=9F=A9?= =?UTF-8?q?=E9=98=B5.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0054.螺旋矩阵.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/problems/0054.螺旋矩阵.md b/problems/0054.螺旋矩阵.md index f686b274..3f85c607 100644 --- a/problems/0054.螺旋矩阵.md +++ b/problems/0054.螺旋矩阵.md @@ -111,15 +111,12 @@ public: // 如果min(rows, columns)为奇数的话,需要单独给矩阵最中间的位置赋值 if (min(rows, columns) % 2) { if(rows > columns){ - for (int i = mid; i < mid + rows - columns + 1; ++i) - { + for (int i = mid; i < mid + rows - columns + 1; ++i) { res[count++] = matrix[i][mid]; } - } - else{ - for (int i = mid; i < mid + columns - rows + 1; ++i) - { + } else { + for (int i = mid; i < mid + columns - rows + 1; ++i) { res[count++] = matrix[mid][i]; } }