标签:代码 std http target ack lan else nbsp code
这是道SB模拟题,NOIP--难度
直接贴代码
#include<iostream> #include<cstdio> using namespace std; int n,num=1,zong,heng; int f[41][41]; int main(){ scanf("%d",&n); heng=n/2+1; zong=1; while(num<=n*n){ f[heng][zong]=num; if(f[heng+1][zong-1]||((heng+1>n)&&(zong-1==0)))zong++; else if(heng+1>n)heng=1,zong--; else if(zong-1==0)zong=n,heng++; else heng++,zong--; num++; } for(int i=1;i<=n;i++) { for(int j=1;j<n;j++) printf("%d ",f[j][i]); printf("%d\n",f[n][i]); } return 0; }
标签:代码 std http target ack lan else nbsp code
原文地址:http://www.cnblogs.com/ghostfly233/p/6861896.html