ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1261. Чаевые

Hint or If you don't know how to solve...
Послано Leonid (SLenik) Andrievskiy 22 июл 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.