本来想用c实现,可是还没来得及细细研究,这里用STL中的next_permutation水过
标记一下,以后自己C实现
题目地址
http://poj.org/problem?id=1731
Orders
Time Limit:1000MS |
|
Memory Limit:10000K |
Description
The stores manager has sorted all kinds of goods in an alphabetical order of their labels. All the kinds having labels starting with the same letter are stored in the same warehouse (i.e. in the same building) labelled with this letter. During the day the stores manager receives and books the orders of goods which are to be delivered from the store. Each order requires only one kind of goods. The stores manager processes the requests in the order of their booking.
You know in advance all the orders which will have to be processed by the stores manager today, but you do not know their booking order. Compute all possible ways of the visits of warehouses for the stores manager to settle all the demands piece after piece during the day.
Input
Input contains a single line with all labels of the requested goods (in random order). Each kind of goods is represented by the starting letter of its label. Only small letters of the English alphabet are used. The number of orders doesn't exceed 200.
Output
Output will contain all possible orderings in which the stores manager may visit his warehouses. Every warehouse is represented by a single small letter of the English alphabet -- the starting letter of the label of the goods. Each ordering of warehouses is written in the output file only once on a separate line and all the lines containing orderings have to be sorted in an alphabetical order (see the example). No output will exceed 2 megabytes.
Sample Input
bbjd
Sample Output
bbdj
bbjd
bdbj
bdjb
bjbd
bjdb
dbbj
dbjb
djbb
jbbd
jbdb
jdbb
分享到:
相关推荐
北大POJ1016-Numbers That Count【字符串处理】 解题报告+AC代码
在进行ACM编程训练时做字符串专题的一些题目(POJ1782,POJ1790,POJ1951,POJ2003,POJ2121)
上面可能有poj的题目,hdu的题目,spoj的题目,sgu的题目,hust上的题目,fzu上的题目
POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类
poj题目2775文件子目录源代码,递归经典题目,
POJ1048,加强版的约瑟夫问题 难度中等
解决算法问题 poj1082, poj1150, poj1180, poj1201, poj1222,代码完成所给题目要求。
poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题...
2遍dp poj_3613解题报告 poj_3613解题报告
poj典型题目解题思路详解 包含源代码和解题时应注意的问题及题目陷阱设计分析
poj上第1990题目源码,用到了2个树状数组,这题数据结构是关键,想到了题目就很简单了
POJ题目及算法,包括动态规划、深搜广搜等算法。含相关注释。
LeetCode判断字符串是否循环 :bookmark_tabs:Plan 动态规划 背包问题 动态规划 POJ 3267 POJ 1260 POJ 1015 POJ 3176 POJ 1080 POJ 1159 POJ 2533 POJ 1836 Leetcode 70 Leetcode 309 搜索 DFS POJ 2488 POJ 3083 ...
问题:求平面上多个矩形的总面积。 算法:线段树(经典的线段树题目)
poj 1699的代码和方法说明,个人原创
Time Limit: 1000ms Memory limit: 65536kB 题目描述 有9个时钟,排成一个3*3的矩阵。 现在需要用最少的移动,将9个时钟的...输出一个最短的移动序列,使得9个时钟的指针都指向12点。按照移动的序号大小,输出结果
简单地poj1001代码,是典型的利用数组输出结果的方法,关键的是测试数据。
POJ 2692:假币问题 时间限制: 1000ms 内存限制: 65536kB 描述 赛利有12枚银币。其中有11枚真币和1枚假币。假币看起来和真币没有区别,... 输出哪一个标号的银币是假币,并说明它比真币轻还是重(heavy or light)。
三道几何题:hdu 1007、hdu 2289、poj 3714
POJ1753 Flip Game题目完整代码及报告