#P1061. [NOIP 2006 普及组] Jam 的计数法
[NOIP 2006 普及组] Jam 的计数法
Description
Jam is an eccentric scientist who likes to be unconventional. He does not count with Arabic numerals, but with lowercase English letters. He believes this makes the world more colorful.
In his counting system, every number has the same length (uses the same number of letters). The English letters keep their original order, and a letter earlier in the alphabet is smaller than a letter later in the alphabet. We call such “numbers” Jam numbers. In a Jam number, all letters are distinct and strictly increasing from left to right. Each time, Jam also specifies the range of letters to use; for example, from means only the letters can be used. If the length is further specified to be , then the number immediately following the Jam number should be (if we denote the Jam numbers and by and in order, then , and there is no Jam number such that ).
Your task: Given a Jam number read from the file, output in order the next Jam numbers. If there are fewer than Jam numbers after it, output as many as exist.
Input Format
There are lines.
The first line contains positive integers , separated by a space.
(Here, is the index of the smallest letter used, is the index of the largest letter used, and is the length of the number. These numbers satisfy .)
The second line is a string with lowercase letters, which is a valid Jam number.
The given testdata is correct; no validation is needed.
Output Format
Output up to lines: the next Jam numbers after the input Jam number in order. If there are fewer than Jam numbers after it, output as many as exist. Print exactly one Jam number per line, each being a string of lowercase letters, with no extra spaces.
2 10 5
bdfij
bdghi
bdghj
bdgij
bdhij
befgh
Hint
NOIP 2006 Junior Problem 3.
Translated by ChatGPT 5
京公网安备 11011102002149号