I did it the smart brute force way. I only had 10! orders to go through, so it was not really necessary to optmize.
If you want to optimize, though, you have a few rules which you can use:
(A + A + 0) -> B % 2 = 0
(A + A + 1) -> B % 2 = 1
(A + B + 0 = B) -> A = 0
The third parameter represents the carry. As you can see, these rules are not very helpful and are very specialized. Therefore, I dropped the whole rule thing and went brute force through it.




Reply With Quote