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