Orders
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
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
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 输出有重复字符的全排列,dfs。 代码:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <stack>
#include <map> using namespace std;
int vis[],n;
char b[];
void dfs(int k)
{
if(k == n)
{
cout<<b<<endl;
return;
}
for(int i = ;i < ;i ++)
{
if(!vis[i])continue;
vis[i] --;
b[k] = 'a' + i;
dfs(k + );
vis[i] ++;
}
}
int main()
{
char ch;
while((ch = cin.get())!='\n')
{
n ++;//记录字符个数
vis[ch - 'a']++;//记录每个字母的个数
}
b[n] = '\0';
dfs();
}
Orders的更多相关文章
- POJ1270 Following Orders[拓扑排序所有方案 Kahn]
Following Orders Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 4885 Accepted: 1973 ...
- Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property 'orderdetails' of 'class com.luchao.mybatis.first.po.Orders' with value 'Orderdetail [id=null, ordersId=3, itemsId=1, it
从上面异常的解释来看是因为反射不能将Orders设置到orderdetails属性上,仔细检查了MyBatis的配置文件,发现: <collection property="order ...
- poj 1731 Orders
http://poj.org/problem?id=1731 Orders Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 9 ...
- 8.1:SportsStore:Orders and Administration
本章,作者将通过收集和验证购物明细,来完成SportsStore应用,并在Deployd服务器上存储该订单.作者也构建了一个管理应用,允许认证用户查看订单,和管理产品分类. 1.准备实例项目 2.获取 ...
- POJ1270 Following Orders (拓扑排序)
Following Orders Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 4254 Accepted: 1709 ...
- 生成订单:三个表(Products,Orders,OrderItem)
1.有三个表(Product上,Orders,OrderItem) 分别创建对应的三个实体类 OrderItem中有外键Order_id 参考Orders中的id :Product_id参考Produ ...
- POJ 1270 Following Orders
Following Orders Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 4902 Accepted: 1982 ...
- How to Manage Amazon-Fulfilled Orders - Cancel an Amazon-Fulfilled Order
You may request to cancel customer orders that have a status of "Pending" or "Unshipp ...
- 错误代码: 1142 REFERENCES command denied to user 'wuyong'@'localhost' for table 'orders'
错误代码: 1142 REFERENCES command denied to user 'wuyong'@'localhost' for table 'orders' 原因:在使用SQLyog操作数 ...
随机推荐
- vue下个兄弟节点
checkOne(e) { e.currentTarget.nextElementSibling.style.background = 'red' }
- offset的坑 使用前要将对象先show
使用jquery $('#obj').offset( {top:300, left: 600}); 如果设置offset之前是隐藏的,那么你设置新的offset之后就不会是指定的位置,而且会越飞越远, ...
- IdentityServer4在Asp.Net Core中的应用(一)
IdentityServer4是一套身份授权以及访问控制的解决方案,专注于帮助使用.Net 技术的公司为现代应用程序建立标识和访问控制解决方案,包括单点登录.身份管理.授权和API安全. 下面我将具体 ...
- keras运行gan的几个bug解决
http://blog.csdn.net/u012317000/article/details/79211274 https://www.jianshu.com/p/5b1f7004144d
- Performance js
转贴:https://10up.github.io/Engineering-Best-Practices/javascript/#performance Performance Writing per ...
- Python连接SQLite数据库代码
import sqlite3 # create database conn = sqlite3.connect('test.db') #不存在就创建后再打开 print ("Opened d ...
- eclipse使用lombok
1.下载lombok.jar,将lombok复制到eclipse的安装路径下,如图: 2.在eclipse.ini配置文件最后加入:-javaagent:D:\Program Files\Eclips ...
- [oracle] DBLINK +同义词,实现本地数据库访问另一台机器的数据库
起因:订单表原来在90库上,后各种原因移到了40库上,需访问40库上的订单表.采用DBLINK+同义词方法: -- 1 在90机器上用GPSV4登录PLSQL,创建DBLINK,从本地数据库,连接到远 ...
- iptables详解(10):iptables自定义链
前文中,我们一直在定义规则,准确的说,我们一直在iptables的默认链中定义规则,那么此处,我们就来了解一下自定义链. 你可能会问,iptables的默认链就已经能够满足我们了,为什么还需要自定义链 ...
- TCP的time_wait、close_wait状态
转载:http://huoding.com/2013/12/31/316 http://blog.csdn.net/lxnkobe/article/details/7525317 http://k ...