102023: [AtCoder]ABC202 D - aab aba baa

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $400$ points

Problem Statement

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.

Constraints

  • $1 \leq A, B \leq 30$
  • $1 \leq K \leq S$, where $S$ is the number of strings of length $A + B$ containing $A$ occurrences of a and $B$ occurrences of b.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$A$ $B$ $K$

Output

Print the answer.


Sample Input 1

2 2 4

Sample Output 1

baab

Here are the strings containing two as and two bs in the lexicographical order: aabb, abab, abba, baab, baba, and bbaa. The fourth string, baab, should be printed.


Sample Input 2

30 30 118264581564861424

Sample Output 2

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

$K$ may not fit into a $32$-bit integer type.

Input

题意翻译

### 【题意简述】 给定 $A,B,K$ 三个正整数。 求以 $A$ 个 $a$ , $B$ 个 $b$ 组成的长度为 $A\ +\ B$ 字符串的若干种可能中,按词典序的第 $K$ 种可能。 ### 【数据范围】 令 $S$ 所有的可能数目。 $ 1 ≤ A, B ≤ 30 $ $1 ≤ K ≤ S$

加入题单

算法标签: