HBC24709真假堂主[USACO 2011 Mar B]A spiral walk题解

回忆凄美了谁 算法基础篇 68 0
挑战自我,勇攀编程高峰!全网最全C++题库,助您成为编程达人。
Oh how the cows love to walk in their square pasture with sides of length N (1

Oh how the cows love to walk in their square pasture with sides of length N (1 <= N <= 750) and which is partitioned into N*N squares. They enjoy the sights, the smells, and the general ambience of the grass and trees. Bessie has decided to take the cows on the longest possible walk from the upper left corner to the center (or near the center when N is even) of the pasture, passing through each and every square along the way after starting. She has decided to create the obvious clockwise spiral route (example below) for this evening's stroll. Write a program to create a map for her that shows the order of squares she should visit. By way of example, for pastures of size N=3 and N=4, here are the routes Bessie should use: 1 2 3 1 2 3 4 8 9 4 12 13 14 5 7 6 5 11 16 15 6 10 9 8 7

HBC24709真假堂主[USACO 2011 Mar B]A spiral walk题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
全网最全C++题库,助您挑战自我,突破极限,成为编程领域的佼佼者!

标签: HBC24709真假堂主[USACO 2011 Mar B]A spiral walk题解