## CCC '01 S2 - Spirals

View as PDF

Points: 5
Time limit: 2.0s
Memory limit: 16M

Problem type
##### Canadian Computing Competition: 2001 Stage 1, Junior #4, Senior #2

A spiral of numbers can start and end with any positive integers less than . Write a program which will accept two positive integers and as input, and output a list of numbers from to inclusive, shown in a spiral. You may assume that the end value is greater than or equal to the start value.

A spiral starts with the first number in the centre. The next number appears immediately below the first number. The spiral continues with the numbers increasing in a counter-clockwise direction until the last number is printed.

#### Sample Input 1

10
27

#### Sample Output 1

      27 26
16 15 14 25
17 10 13 24
18 11 12 23
19 20 21 22

#### Sample Input 2

7
12

#### Sample Output 2

12 11
7 10
8  9

• commented on Jan. 22, 2021, 3:01 p.m.

Leading and trailing whitespace do not matter. In other words: as long as the right numbers are on the right line in the right order, then it is correct, unlike some other questions which are a bit more strict with output (e.g. ccc00j1).

• commented on Dec. 24, 2019, 11:37 a.m.

this is ridiculous i wanna use numpy but it gives module no found error

• commented on Feb. 5, 2018, 6:57 p.m.

I tend to use Turing a lot for some questions due to how fast it can solve questions, but it seems that the DMOJ Turing Judge doesn't really allow the Text.Locate method to work and constantly produces IR as a result. I can work around that of course, but was just wondering why the DMOJ Turing Judge seems to dislike Text.Locate

• commented on Feb. 5, 2018, 9:50 p.m. edited

The DMOJ is primarily a text-based input/output system, so using standard IO methods is required. Text.Locate functionality is fundamentally unsupported at the operating system level for file streams.

• commented on Feb. 20, 2017, 9:17 p.m.

My code works for all the other cases expect test case #1, anybody know why?

• commented on Dec. 4, 2017, 2:24 a.m.

I'm sure you have figured it out by now, but for anyone else: x == y.