We call a permutation of integers anti-arithmetic,
when there are no three-term arithmetic series in this permutation,
i.e. there are no such three indices , that integers (in this order) make an arithmetic series.
For example the series of integers is an anti-arithmetic permutation of integers .
The series is not an anti-arithmetic permutation,
because its first, fifth and sixth term: form an arithmetic series
(as well as its second, forth and fifth term: and second third and forth term: form arithmetic series).
Task
Write a program that:
reads one positive integer from the standard input,
computes any anti-arithmetic permutation of numbers
and writes it to the standard output.
Input
There is one positive integer , , written in the standard input.
Output
The standard output should be composed of lines.
These lines should contain different integers from the set , one in each line.
The numbers in the consecutive lines should form an anti-arithmetic permutation of numbers .
Example
For the input data:
5
the correct result is:
3
1
0
4
2
Task author: Wojciech Guzicki.
Kontakt
W razie problemów technicznych ze Szkopułem, prosimy o kontakt mailowy pod adresem szkopul@fri.edu.pl.
Jeśli chciałbyś porozmawiać o zadaniach, rozwiązaniach lub problemach technicznych, odwiedź nasze serwery na Discordzie. Są one moderowane przez społeczność, ale członkowie zespołu wsparcia również aktywnie się tam udzielają.