시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 34 | 17 | 12 | 66.667% |
The residents of a remote Himalayan monastery believe that strings of repeated syllables in their language have mystic power, particularly if they can produce chants containing all possible strings of a given length. Because outsiders are not even allowed to know the syllables, they have replaced them with single characters such that the resulting strings can be converted into chants easily. They have developed the following rules.
Write a program that will read in the length of the sequence and the maximum number of adjacent ‘*’s and ‘!’s and produce all acceptable sequences. These should be in lexicographic sequence, where, for this problem, ‘*’ is deemed to precede ‘!’.
Input consists of sequence of lines each containing 3 integers: n (1 ≤ n ≤ 10), nstar and nbang, and is terminated by a line containing 3 zeroes (0 0 0).
Output consists of, for each problem in the set, a header line starting with ‘Sequence set ‘, followed by a running number starting at 1, followed by the ordered list of such sequences, i.e. those with no more than nstar consecutive ‘*’s and no more than nbang consecutive ‘!’s, one per line, followed by a blank line.
1 1 1 3 0 0 2 10 1 0 0 0
Sequence set 1 * ! Sequence set 2 Sequence set 3 ** *! !*
ICPC > Regionals > South Pacific > South Pacific Region > New Zealand Programming Contest > NZPC 2004 F번