#C1905. Generate Sequence
Generate Sequence
Generate Sequence
Given a single integer N, generate a sequence of N numbers based on the following rules:
- The first number is always 1.
- For each subsequent number, consider the index i (with the first element having
i = 1
): - If i is odd, the next number is obtained by multiplying the previous number by 2. That is, \(a_{i+1} = a_i \times 2\).
- If i is even, the next number is obtained by multiplying the previous number by 3. That is, \(a_{i+1} = a_i \times 3\).
- If N is less than or equal to 0, output an empty sequence.
For example, if N = 5
, the sequence is: 1, 2, 6, 12, 36.
inputFormat
The input consists of a single integer N provided via standard input.
Constraints: N can be any integer. When N ≤ 0, you should output an empty sequence.
outputFormat
Output the generated sequence on a single line, with each number separated by a single space via standard output. If the sequence is empty, output nothing.
## sample5
1 2 6 12 36