POJ 1731:Orders
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 9940 | Accepted: 6048 |
Description
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
Output
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
大水,直接next_permutation。
代码:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#pragma warning(disable:4996)
using namespace std; char test[250]; int main()
{
while (cin >> test)
{
sort(test, test + strlen(test));
do {
cout << test << endl;
} while (next_permutation(test, test + strlen(test)));
}
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
POJ 1731:Orders的更多相关文章
- POJ 1731 Orders(STL运用)
题目地址:POJ 1731 这题能够直接用STL函数做,非常轻松..next_permutation函数非常给力.. 代码例如以下: #include <algorithm> #inclu ...
- POJ 3321:Apple Tree + HDU 3887:Counting Offspring(DFS序+树状数组)
http://poj.org/problem?id=3321 http://acm.hdu.edu.cn/showproblem.php?pid=3887 POJ 3321: 题意:给出一棵根节点为1 ...
- POJ 3252:Round Numbers
POJ 3252:Round Numbers Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10099 Accepted: 36 ...
- poj 1731 Orders
http://poj.org/problem?id=1731 Orders Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 9 ...
- poj 1731 Orders(暴力)
题目链接:http://poj.org/problem?id=1731 思路分析:含有重复元素的全排列问题:元素个数为200个,采用暴力枚举法. 代码如下: #include <iostream ...
- Orders POJ - 1731
The stores manager has sorted all kinds of goods in an alphabetical order of their labels. All the k ...
- POJ 1459:Power Network(最大流)
http://poj.org/problem?id=1459 题意:有np个发电站,nc个消费者,m条边,边有容量限制,发电站有产能上限,消费者有需求上限问最大流量. 思路:S和发电站相连,边权是产能 ...
- POJ 3436:ACM Computer Factory(最大流记录路径)
http://poj.org/problem?id=3436 题意:题意很难懂.给出P N.接下来N行代表N个机器,每一行有2*P+1个数字 第一个数代表容量,第2~P+1个数代表输入,第P+2到2* ...
- POJ 2195:Going Home(最小费用最大流)
http://poj.org/problem?id=2195 题意:有一个地图里面有N个人和N个家,每走一格的花费是1,问让这N个人分别到这N个家的最小花费是多少. 思路:通过这个题目学了最小费用最大 ...
随机推荐
- HDU 1024:Max Sum Plus Plus 经典动态规划之最大M子段和
Max Sum Plus Plus Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- jenkins#安装jenkins之后的操作
1.全局安全配置 运行用户注册 任何用户可以做任何事情 2.全局工具配置 指定maven的settings文件位置 指定java信息 指定maven信息 指定git信息
- hibernate 中 query.list()的优化
2018年3月15日 今天做项目遇到一个需求,问题是在调用query.list()的时候,因为数据也多大概700条左右,查询一次需要30s+,这简直是不能忍,于是开始考虑怎么优化. 1.因为是单表查 ...
- delphi base64编码
需要uses IdCoderMIME: function TForm1.Base64E(Path: string): string;var filepath: string; filestream: ...
- DP(动态规划求含有冻结期的买卖股票)-05-动态规划-买卖股票
题目描述 Alice这次决定去股市里当一波韭菜. 她希望你设计一个算法,在满足以下3个约束条件下,计算出最大利润. 1. 你可以多次买卖一支股票,但是对于每支股票,你不能同时参与多笔交易(你必须在再 ...
- mitmproxy(TLS错误)
一.原来的基础上添加代码 """ This inline script allows conditional TLS Interception based on a us ...
- Char、float、Double、BigDecimal
Char初识 char: char类型是一个单一的 16 位 Unicode 字符 char 在java中是2个字节("字节"是byte,"位"是bit ,1 ...
- C#编码习惯2
1.一定要用大括号括住流程控制元素,如for,while,if,switch内嵌的代码,即便只包含一行代码. 2.如果语句中有else if,一定要有一个else跟着最后一个else if. 3.只要 ...
- 12 文件流(Unity3D)
关于文件操作在脚本中可以通过xml或其他的与文件相关的类中封装的一些方法可读取本地Asset文件夹下的xml文档和json文档到游戏中.但是这样操作文件难免会有拖延,C#提供了一种文件操作的方法, ...
- Sklearn K均值聚类
## 版权所有,转帖注明出处 章节 SciKit-Learn 加载数据集 SciKit-Learn 数据集基本信息 SciKit-Learn 使用matplotlib可视化数据 SciKit-Lear ...