ICPC East Central NA Regional Contest 2000, Problem B
A polygonal number is a number which can be represented by a regular geometrical arrangement of equally spaced points, where the arrangement forms a regular polygon. Some examples are shown in the figure below.
The first figure shows the first 4 triangular numbers 1, 3, 6, 10. The next three show the first four square, pentagonal and hexagonal numbers, respectively. In general,
Input Specification
Input will consist of multiple problem instances. Each instance will consist of 3 lines. The first line will be a non-negative integer
Output Specification
For each problem instance, you should output the next 5 poly-polygonal numbers which are greater than or equal to
num:k1 k2 k3 ...
where num
is the poly-polygonal number, and k1
, k2
, k3
… are the indices (in increasing order) of the poly-polygonal number equal to num
. A single space should separate each index, and you should separate each problem instance with a single blank line. The judge's input will be such that the maximum value for any poly-polygonal number will fit in a long variable.
Sample Input
10
6 7 8 9 10 11 12 13 14 15
1000
5
3 4 13 36 124
1
0
Sample Output
1216:9 12
1540:6 10
1701:10 13
2300:11 14
3025:12 15
1:3 4 13 36 124
36:3 4 13 36
105:3 36
171:3 13
1225:3 4 124
Comments