题解 | #蛇形矩阵#
蛇形矩阵
https://www.nowcoder.com/practice/649b210ef44446e3b1cd1be6fa4cab5e
#include <stdio.h> int main() { int l = 0; scanf("%d",&l); int p = 1; int line = 0; int add = 0; for(int i = 0; i < l; i++) { p = p+i; add = i+1; line = p; for(int j = i; j < l; j++) { printf("%d ",line); line += ++add; } printf("\n"); } return 0; }