HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN112 Homeworks 2013-2015 > problem:


14-Spr2-50. 50616 - Snake

CEN112 Homeworks 2013-2015

Start: Dec.15.2013 at 12:00:00 PM
Finish: Dec.15.2013 at 05:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 50754 - Team Standings
• 12-Spr1-40. 50327 - Parallel Lines
• 13-Fall2-20. 50395 - Page "Like" Av...
• 14-Spr1-30. 50492 - Contest Score...
• 14-Spr1-40. 50538 - Sum of kth Dia...
• 14-Spr1-60. 50647 - Spiral
• 14-Spr2-20. 50442 - Polynomial Add...
• 14-Spr2-40. 50361 - Align Two Lists
• 14-Spr2-50. 50616 - Snake
• 14-Spr2-60. 50444 - n digit kth nu...
• 15-SprHW-20. 50446 - Snake
• 15-SprHW-30. 50788 - Eight Puzzle
• 15-SprHW-40. 50746 - Most Visited
• 15-SprHW-60. 50516 - Lines
• 15-SprPr2-20. 50509 - Reading Book
• 15-SprPr2-60. 50766 - Word Puzzle
• 15-SprPr2-80. 50786 - Top Question

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