Logo
(追記) (追記ここまで)

5976번 - A spiral walk 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB32822619975.665%

문제

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

입력

Line 1: A single integer: N

출력

Lines 1..N: N space-separated integers

제한

예제 입력 1

3

예제 출력 1

1 2 3
8 9 4
7 6 5

힌트

출처

Olympiad > USA Computing Olympiad > 2010-2011 Season > USACO March 2011 Contest > Bronze 3번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /