Score : $400$ points
Among the strings of length $A + B$ containing $A$ occurrences of a
and $B$ occurrences of b
, find the string that comes $K$-th in the lexicographical order.
a
and $B$ occurrences of b
.Input is given from Standard Input in the following format:
$A$ $B$ $K$
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
$K$ may not fit into a $32$-bit integer type.