#CCBCHBA0000097. Growing Sequences
Growing Sequences
Growing Sequences
Source: beecrowd
Version: Phuoc Hung OJ Extended
Problem Statement
Read successive integers . For every positive , print one line containing integers 1 through in ascending order, separated by single spaces. Stop immediately at the first zero and produce no output line for that sentinel. Preserve the order of positive inputs.
Input
Several lines, each containing integer . At least one positive value appears before the terminating zero.
Output
For each positive value before zero, print its sequence on one line. Print nothing for the sentinel.
Subtasks
-
Subtask 1 (20%): All positive values obey ; at most 3 values precede the terminating zero.
-
Subtask 2 (30%): All positive values obey ; at most 8 values precede the terminating zero.
-
Subtask 3 (50%): All positive values obey ; at most 25 values precede the terminating zero.
Examples
Example 1
Input:
3
1
4
0
Output:
1 2 3
1
1 2 3 4
Explanation:
Each positive input produces a line 1 through n. Zero ends the input and produces no line. For this sample, the input is 3, 1, 4, 0; the displayed rows follow these rules exactly.
Example 2
Input:
2
0
Output:
1 2
Explanation:
Each positive input produces a line 1 through n. Zero ends the input and produces no line. For this sample, the input is 2, 0; the displayed rows follow these rules exactly.