|
Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Сложность Бета
Write a program that finds all solutions of the puzzle
ABCD + DCBA = CEEC.
Rebus is known to be a replacement of numbers by letters;
each letter is replaced by a digit from 1 to 6 (other figures in
this puzzle are not allowed) so that the written equality is true.
Different letters correspond to different numbers.
Input
You can assume that the input in this problem does not exist
(On the other hand that line will be recorded as
solvable puzzle).
Output
Bring out puzzles. Each solution on a separate line.
Solution is displayed in the form of equality, the corresponding
described puzzle in which all letters are replaced by numbers.
Example (for another puzzle)
If we solved the puzzle, A + B = CD, (and if admitted the numbers 1 to 9), then
conclusion would be (to reduce space is divided into columns):
3 +9 = 12
4 +8 = 12
4 +9 = 13
5 +7 = 12
5 +8 = 13
5 +9 = 14
6 +7 = 13
6 +8 = 14
|
6 +9 = 15
7 +5 = 12
7 +6 = 13
7 +8 = 15
7 +9 = 16
8 +4 = 12
8 +5 = 13
8 +6 = 14
|
8 +7 = 15
8 +9 = 17
9 +3 = 12
9 4 = 13
9 +5 = 14
9 +6 = 15
9 7 = 16
9 8 = 17
|
Для отправки решений необходимо выполнить вход.
|