#C11251. List Processing with Conditional Append
List Processing with Conditional Append
List Processing with Conditional Append
You are given an integer (n) followed by (n) integers. Your task is to process the list according to the following rule: if (n) is odd, append (-1) to the end of the list; otherwise, leave the list unchanged. This problem tests your ability to perform simple list manipulations and handle input/output using standard streams.
inputFormat
The input is read from standard input. The first line contains an integer (n), which denotes the number of elements in the list. The second line contains (n) space-separated integers.
outputFormat
Print the resulting list to standard output as space-separated integers. If (n) is odd, the list will have an extra element (-1) appended at the end.## sample
3
1 2 3
1 2 3 -1