Alien SpiralProblem code: INSOMA1 |
Despite indications to the contrary, India too has had its share of UFOs. There is enormous debate in UFO circles about the veracity of sightings of UFOs in the Aksai Chin area near Kashmir. A naughty local wanted to play truant and decided to set up a fake UFO base. To generate interest, he decided to draw square number patterns on the ground. The general pattern of the square was as follows:
1 2 3 4 5 6 7 8 28 29 48 47 46 45 44 9 27 30 49 50 51 52 43 10 26 31 60 61 64 53 42 11 25 32 59 62 63 54 41 12 24 33 58 57 56 55 40 13 23 34 35 36 37 38 39 14 22 21 20 19 18 17 16 15
You need to write a program to generate such a square for a given input N.
Input
N = the size of the side of a square you should generate
Output
An NxN square according to the rules described above
Example
Input: 8 Output: 1 2 3 4 5 6 7 8 28 29 48 47 46 45 44 9 27 30 49 50 51 52 43 10 26 31 60 61 64 53 42 11 25 32 59 62 63 54 41 12 24 33 58 57 56 55 40 13 23 34 35 36 37 38 39 14 22 21 20 19 18 17 16 15
| Author: | admin |
| Date Added: | 19-03-2009 |
| Time Limit: | - 5 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC |
Comments

Fetching successful submissions

hello how to register for
hello how to register for team