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

Обсуждение задачи 1574. Математики и скобки

ONU_Latysh I can't understand the exaples [2] // Задача 1574. Математики и скобки 11 дек 2011 21:08
Are the answers in exanples the only solutions or are there maultiple ones!?
What we do is we repeatedly move the last bracket to the start of the list. If we have brackets 1234 then we test 1234,4123,3412,2341. On example 1 it is:
)(() , ))(( , ())( , (()) ; from which only the last option is OK. Thus the answer is one.

Hope that helps.
But, why in example №2 answer 2?
sequence: )()(

1234 -> 4123
)()(    ()()

Answer must be 1.