TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

Given two integer sequences A = {a[1], a[2], …, a[n]} and B = {b[1], b[2], …, b[n]}, the sum-sequence of A and B is {a[1] + b[1], a[1] + b[2], …, a[2] + b[1], …, a[n] + b[n]} which are generated by picking one element a[i] in A and other element b[j] in B and adding them to get a new element of the sum-sequence. If all the numbers in sum-sequence are different and can be found from 1 to n * n, then we call (A, B) n-th sequence pair.

Now given a number n, calculate the numbers of n-th sequence pair. Notice that pair (A, B) is equal to (B, A). If all elements in A increase by a constant and all elements in B decrease by the same constant, we also think the resulted pair is equivalent to the original pair. For these reasons, we require that the smallest number in A must be 0 and the smallest number in B must be 1.

Input Format

The input file will contain multiple test cases. Each test case will contains an integer n (2 <= n <= 1000).

Output Format

For each input test case, print the numbers of n-th sequence pair.

Sample Input 1

4
6

Sample Output 1

3
7

Hints

Problem Source

Migrated from old NTUJ.

2009Harbin

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 10000 65536 200