Time Limit: 2 sec / Memory Limit: 256 MB
配点 : 1600 点
問題文
文字列 S に対し、 f(S) を S の巡回シフトのうち辞書順最小のものとします。
たとえば、 S = babca
のとき、 S の巡回シフト (babca
, abcab
, bcaba
, cabab
, ababc
) のうち最小の ababc
が f(S) となります。
あなたは、三個の整数 X, Y, Z が与えられます。
あなたは、 a
をちょうど X 個、b
をちょうど Y 個、c
をちょうど Z 個含む文字列 T を構成したいです。
そのような文字列が複数存在する場合は、 f(T) を辞書順で最大化したいです。
f(T) の辞書順での最大値を求めてください。
制約
- 1 \leq X + Y + Z \leq 50
- X, Y, Z は非負整数である。
入力
入力は以下の形式で標準入力から与えられる。
X Y Z
出力
答えを出力せよ。
入力例 1
2 2 0
出力例 1
abab
T は a
二個と b
二個からならなければなりません。
- T =
aabb
のとき f(T) =aabb
. - T =
abab
のとき f(T) =abab
. - T =
abba
のとき f(T) =aabb
. - T =
baab
のとき f(T) =aabb
. - T =
baba
のとき f(T) =abab
. - T =
bbaa
のとき f(T) =aabb
.
となるので、 f(T) の最大値は abab
です。
入力例 2
1 1 1
出力例 2
acb
Score : 1600 points
Problem Statement
For a string S, let f(S) be the lexicographically smallest cyclic shift of S.
For example, if S = babca
, f(S) = ababc
because this is the smallest among all cyclic shifts (babca
, abcab
, bcaba
, cabab
, ababc
).
You are given three integers X, Y, and Z.
You want to construct a string T that consists of exactly X a
s, exactly Y b
s, and exactly Z c
s.
If there are multiple such strings, you want to choose one that maximizes f(T) lexicographically.
Compute the lexicographically largest possible value of f(T).
Constraints
- 1 \leq X + Y + Z \leq 50
- X, Y, Z are non-negative integers.
Input
Input is given from Standard Input in the following format:
X Y Z
Output
Print the answer.
Sample Input 1
2 2 0
Sample Output 1
abab
T must consist of two a
s and two b
s.
- If T =
aabb
, f(T) =aabb
. - If T =
abab
, f(T) =abab
. - If T =
abba
, f(T) =aabb
. - If T =
baab
, f(T) =aabb
. - If T =
baba
, f(T) =abab
. - If T =
bbaa
, f(T) =aabb
.
Thus, the largest possible f(T) is abab
.
Sample Input 2
1 1 1
Sample Output 2
acb