No.501 Holes and Strings
問題文最終更新日: 2026-06-28 17:04:46
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 160
(順位表)
の他の問題:
Problem Statement
Let $S$ be a string formed by concatenating $N$ uppercase English letters (A to Z) such that the sum of "the number of holes in each letter" equals $D$. Among the strings possible as $S$, find the lexicographically smallest one.
Uppercase letters with $0$ holes: C,E,F,G,H,I,J,K,L,M,N,S,T,U,V,W,X,Y,Z
Uppercase letters with $1$ hole: A,D,O,P,Q,R
Uppercase letters with $2$ holes: B
Input
N D
The input is given as integers.
$1 \le N \le 50000$
$0 \le D \le 2N$
Output
Output the lexicographically smallest string among the strings possible as $S$. Print a newline at the end.
Sample
Sample 1
Input
5 6
Output
AAAAB
Sample 2
Input
2 1
Output
AC
Sample 3
Input
4 8
Output
BBBB
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
startcpp
ixmel