ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1261. Tips

Hint or If you don't know how to solve...
Posted by Leonid (SLenik) Andrievskiy 22 Jul 2009 04:32
1. In a few words: you should find x1 and x2, such that:

a) x1 - x2 = N
b) x1 and x2 has only '0' and '1' numbers in ternary number system.
c) x1 & x2 = 0. x1 and x2 are written in ternary number system. '&' means logical AND operation [0 & 0 = 0, 0 & 1 = 0, 1 & 0 = 0, 1 & 1 = 1], which is applied to the corresponding pairs of digits from the x1 and x2 (in ternary number system).

2. I recommend you to write a) and b) conditions for all digits of the x1 and x2 in ternary number system, and then in decimal number system.

3. You should differ only two variants: if N has only '0' and '1' numbers in ternary number system and the opposite variant.

4. If you need some other hints, you can write me shellkunchik<at>yandex<point>com.