📄 1710.txt
字号:
#include"iostream.h"
#include"memory.h"
int n;
bool map[101][101];
void init()
{int i,j;bool k;
k=1;
for(i=1;i<=n;i++,k=!k)
map[i][1]=k;
for(i=1;i<=n;i++)
for(j=2;j<=n;j++)
map[i][j]=!map[i][j-1];
}
void doit()
{int i,j,step=2*n+1;bool k=true;
for(i=1;i<n;i++)
{cout<<step;
for(j=1;j<=n;j++)
if(map[i][j]==k)cout<<' '<<(i-1)*n+j;
cout<<endl;
step+=2;k=!k;
cout<<step;
for(j=1;j<=n;j++)
if(map[i][j]==k)cout<<' '<<(i-1)*n+j;
cout<<endl;
step+=2;k=!k;
}
if(n%2)
{for(i=1;i<n;i++,step+=2)
cout<<step<<' '<<(n-1)*n+i<<endl;}
else
for(i=n;i>1;i--,step+=2)
cout<<step<<' '<<(n-1)*n+i<<endl;
}
int main()
{int t;
//cin>>t;
//while(t--)
{cin>>n;
init();
doit();
//cout<<endl;
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -