0029. 0's and 1's
|Имя входного файла:
|Имя выходного файла:
|Ограничение по времени:
|Ограничение по памяти:
Vitya learned in his school about different scales of notation. When he returned home in the evening Vitya guessed that there are two digits allowed in any scale of notation – they are 0 and 1. And he started to construct equalities in different scales where only 0's and 1's were allowed. There were no problems with addition, but multiplication interested him more. Vitya noticed that the equality 11*11=1001 is only true in the binary scale of notation, but it is false in any other.
Now he wants to construct such an equality for other scales of notation. Write a program for Vitya which given a base of the scale will display an equality in form A*B=C (where A, B and C contain only 0's and 1's) or decide that it is impossible.
The input file contains only one number Z representing the base of the selected scale of notation. Z is in range 2≤ Z≤ 36.
If it is possible to construct such an equality display any in the only line of the output file using pattern A*B=C. The equality is to be true only in the scale of notation with base Z and false in any other. If it is impossible leave the output file empty.
The output file size is limited to 10000 bytes.
Источник: Petrozavodsk training camp, Summer 2002. Startup contest
Автор: Andrew Lopatin, Nick Durov
Обсудить Отправить решение
Версия для печати