12499 - Pointer Integer Array   

Description

(Partial Judge) Given a pointer integer array **ptr with size N, and an integer array *array with size (N+1)*N/2. Please use malloc function to allocate memory to **ptr and *array. The *array is an ascending sequence of number. Each pointer in array **ptr shall point to one element of *array where ptr[0] should point to array[0] and other ptr[i] should point to array[(i+1)*i/2] for all 0 < i < N.

For example, when n = 5, the size of **ptr will be 5, and the size of *array will be 15. The first pointer of **ptr is *ptr[0] which points to array[0], and the second pointer of **ptr is *ptr[1] which points to array[1], and the third pointer of **ptr is *ptr[2] which points to array[3], and the forth pointer of **ptr is *ptr[3] which points to array[6].

main.c

function.h

Input

The first line is size of **ptr

The second line is offset

0 <= offset < size <3000

Output

Print each pointer of *(*ptr + offset)

Note that you need to print a newline character ‘\n’ after each number, that is, just one number will be shown in each line of the output.

Sample Input  Download

Sample Output  Download

Partial Judge Code

12499.c

Partial Judge Header

12499.h

Tags




Discuss