HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Fyodor Menshikov. Training > problem:


03F. 50616 - Snake

Guest
• Review clarifications (1)

Volume problems

• 02D. 50667 - Intersecting Line Seg...
• 02E. 50607 - Long sum
• 02F. 50647 - Spiral
• 03A. 50633 - The prime factors
• 03B. 50720 - Permutations (2)
• 03C. 50615 - Moneybox
• 03D. 50666 - The card and envelope
• 03E. 50606 - Long product
• 03F. 50616 - Snake
• 04A. 50634 - Perfect numbers
• 04B. 50635 - Decomposition into terms
• 04C. 50608 - Gangsters
• 04D. 50627 - Area of a polygon
• 04E. 50609 - Long division
• 04F. 50636 - Brackets
• 05E. 50637 - Number systems

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Автор: Фёдор Меньшиков, ВГПУ.

Snake

Russian
Draw a square from NxN cells filled with numbers from 1 to N2 in the shape of "Snake" (see examples below).
Input
The first line contains a single number N.
Output
Print N lines of N numbers, separated by spaces. It's not allowed beginning snake from another corner or another direction.

Restrictions
2 ≤ N ≤ 100.

Input 1 Input 2 Input 3
3
4
5
Output 1 Output 2 Output 3
1 2 6
3 5 7
4 8 9
 1  2  6  7
 3  5  8 13
 4  9 12 14
10 11 15 16
 1  2  6  7 15
 3  5  8 14 16
 4  9 13 17 22
10 12 18 21 23
11 19 20 24 25

Для отправки решений необходимо выполнить вход.

www.contester.ru