The code with cipher 3 reversed of a non-negative integer is to code the number in base 3 and revert the coding. In order to make it even more cryptic, you will change the digits of the resulting number according to the following relation: 0 ’-’, 1 ’+’, 2 ’*’.
The code for a negative integer starts with a ’:’ which is followed by the coding with cipher 3 reversed of .
2077 is represented in base 3 as 2211221 (reverted as 1221122)
and coded as +**++**
-2077 is coded as :+**++**
0 is represented in base 3 as 0 (reverted as 0) and coded as
-
31 is represented in base 3 as 1011 (reverted as 1101) and coded
as ++-+
257 is represented in base 3 as 100112 (reverted as 211001) and
coded as ++–+
5766 is represented in base 3 as 21220120 (reverted as 02102212)
and coded as -*+-**+*
Write a program to code integers in cipher 3 reverse coding according to the described algorithm.
The input is a sequence of integer numbers.
The output is the code in cipher 3 reversed of each number.
Follow the format of the examples.
Author: Unknown
Translator: Maria Serna
Generation: 2026-01-25T14:14:11.788Z
© Jutge.org, 2006–2026.
https://jutge.org