Bracket-and-bar Sequences
시간 제한2초메모리 제한1024 MB
연결과 (A|B) 감싸기 규칙으로 만든 괄호와 막대 문자열을 길이별로 나열하고, 문자열과 정수를 서로 대응시킨다.
문제
Let us define the set of regular bracket-and-bar sequences recursively. It is the set of strings that can be obtained following only the rules below:
- (empty string)
- (concatenation)
(|)
For example, the sequences containing two triples "(|)" look as folows: "((|)|)", "(|(|))", "(|)(|)".
Establish a correspondence between regular bracket-and-bar sequences of certain length and integers, and implement that correspondence.