問題一覧 > 通常問題

No.501 Holes and Strings

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 334
作問者 : startcpp / テスター : ixmel
お気に入りにしたユーザー ProblemId : 1075 / 自分の提出
問題文最終更新日: 2026-06-28 17:04:46
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もしくは右上の雲マークをクリックしてアカウントを作成してください。