Donat un natural nn, escriu un programa que mostri pel canal de sortida la següent seqüència (de mida nn):
1,n,2,n−1,3,n−2,4,n−3,…1, n, 2, n-1, 3, n-2, 4, n-3, \dots
L’entrada consisteix en un natural n>0n > 0.
Escriu la següent seqüència.
tenint en compte el valor de nn.
The official statement of a problem is always the one in the PDF document. The HTML version of the statement is also given to help you, but may contain some content that is not well displayed. In case of doubt, always use the PDF.
Input
4
Output
1 4 2 3
5
1 5 2 4 3