#K65587. Beautiful Sequence
Beautiful Sequence
Beautiful Sequence
Given an integer n, generate a beautiful sequence containing exactly n elements such that the sum of the sequence is maximized. For the special case when \( n = 1 \), the only possible sequence is \( [1] \). For all other cases (i.e., \( n \ge 2 \)), the sequence is constructed by alternating the numbers \(2\) and \(3\), starting with \(2\). This construction guarantees that the absolute difference between any two consecutive numbers is exactly \(1\), and the sum of the sequence is maximized.
In other words, if \( n \ge 2 \), the sequence will be:
[ \begin{cases} 2, & \text{if } i \text{ is even}\ 3, & \text{if } i \text{ is odd} \end{cases} \quad \text{for } i=0,1,2,\ldots,n-1. ]
Your task is to read n from the input and output the corresponding beautiful sequence.
inputFormat
The input consists of a single integer \( n \) (\(1 \le n \le 10^6\)) provided via standard input.
outputFormat
Output the generated beautiful sequence as \( n \) space-separated integers in a single line via standard output.
## sample5
2 3 2 3 2