In the event of technical difficulties with Szkopuł, please contact us via email at szkopul@fri.edu.pl.
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.
Każdą permutację liczb
można zakodować za pomocą ciągu
,
w którym
jest równe liczbie wszystkich
takich, że:
(
oraz
), dla każdego
.
Kodem permutacji jest
ciąg:
.
Napisz program, który:
Na standardowym wyjściu należy zapisać:
Dla danych wejściowych:
7 0 0 1 0 2 0 4
poprawną odpowiedzią jest:
1 5 2 6 4 7 3
Dla danych wejściowych:
4 0 2 0 0
poprawną odpowiedzią jest:
NIE
Autor zadania: Krzysztof Diks.