Monday, November 9, 2009

Snail Matrix

This problem was of the 2nd competition of programming of turabo's university.

Description of the Problem: The problem will ask a even number to make a snail matrix. For example
a 4 * 4 snail matrix will be:

10 09 08 07
11 02 01 06
12 03 04 05
13 14 15 16

Then the program will ask the quadrant you want to see. The quadrants are 1, 2, 3, 4.

2 | 1
------
3 | 4

The program will run like this:

Please enter the number of rows: 4
Please enter the number of the quadrant you want to look: 1

08 07
01 05

Please enter the number of rows: 6
Please enter the number of the quadrant you want to look: 3


29 12 03
30 13 14
31 32 33

Here is my solution in C#

No comments:

Post a Comment