蛇形填数 描述 在n*n方陈里填入1,2,...,n*n,要求填成蛇形。例如n=4时方陈为: 10 11 12 1 9 16 13 2 8 15 14 3 7 6 5 4

#include <stdio.h> int main() { int a[100][100]; int m,n,M,N,x,y,i,j,t=0; scanf("%d",&M); N=M; for(x=0,y=M-1;N>0;N=N-2,x++,y--) { for(m=x,n=y,i=0;i<N;i++,m++) { t++; a[m][n]=t; }  for(m=y,n=y-1,i=N-2;
相关文章
相关标签/搜索