当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3049:Securing the Barn

题目描述
Farmer John has installed a new security system on the barn and now must issue a valid password to the cows in the herd. A valid password consists of L (3 <= L <= 15) different lower-case characters (from the traditional latin character set 'a'...'z'), has at least one vowel ('a', 'e', 'i', 'o', or 'u'), at least two consonants (non-vowels), and has characters that appear in alphabetical order (i.e., 'abc' is valid; 'bac' is not).

Given a desired length L along with C lower-case characters, write a program to print all the valid passwords of length L that can be formed from those letters. The passwords must be printed in alphabetical order, one per line.
输入解释
* Line 1: Two space-separated integers, L and C

* Line 2: C space-separated lower-case characters that are the set of characters from which to build the passwords
输出解释
* Lines 1..?: Each output line contains a word of length L characters (and no spaces). The output lines must appear in alphabetical order.
输入样例
4 6
a t c i s w
输出样例
acis
acit
aciw
acst
acsw
actw
aist
aisw
aitw
astw
cist
cisw
citw
istw
提示
INPUT DETAILS:
Passwords of length 4 chosen from the given six characters

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3049

最后修改于 2020-10-29T06:51:10+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536