HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Linear Data Structures: Arrays > problem:


50616 - Snake

Guest
• Review clarifications (1)

Section problems

• 50468 - Draw Matrix - 2
• 50423 - Numbers square
• 50344 - Profit or Loss
• 50445 - Cryptography
• 50410 - Zero Padding
• 50380 - Sum of the Numbers in the ...
• 50300 - Matrix
• 50611 - Maximum of the minima
• 50616 - Snake
• 50647 - Spiral
• 50543 - Hotel rooms
• 50271 - Factorial
• 50419 - The longest bitonic sequence
• 50326 - Matrix Operations
• 50329 - Draw Matrix-1
• 50541 - Binary to decimal
• 50592 - Matrix Multiplication

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