atcoder#ABC202D. [ABC202D] aab aba baa
[ABC202D] aab aba baa
Score : points
Problem Statement
Among the strings of length containing occurrences of a
and occurrences of b
, find the string that comes -th in the lexicographical order.
Constraints
- , where is the number of strings of length containing occurrences of
a
and occurrences ofb
. - All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
2 2 4
baab
Here are the strings containing two a
s and two b
s in the lexicographical order: aabb
, abab
, abba
, baab
, baba
, and bbaa
.
The fourth string, baab
, should be printed.
30 30 118264581564861424
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
may not fit into a -bit integer type.