题解 | #蛇形矩阵#
蛇形矩阵
http://www.nowcoder.com/practice/649b210ef44446e3b1cd1be6fa4cab5e
C++ 简单易懂不需要任何额外容器```cpp #include using namespace std; int main() { int a; while (cin >> a) { int m = 1; int n; for (int i = 0; i < a; i++) { m += i; for (int j = i; j < a; j++) { int c = 1 + j; if (j == i) { n = m; cout << n << " "; } else { cout << (n += c) << " "; } } cout << endl; } } }