由一维规律推出二维规律
int main()
{
int n, m;
while (cin >> n >> m)
{
int x = 1, y = 1, dx = n, dy = m;
int k = 0;
//int j = (n*m) & 1 ? 1 : 0;
while (k != n * m)
{
if (k == n * m - 1) { cout << x << " " << y << endl;break; }
printf("%d %d\n%d %d\n", x, y, dx, dy);
if (y < m)y++;else { x++; y = 1; }//下一行
if (dy > 1)dy--;else { dx--; dy = m; }
k += 2;
}
}
return 0;
}