题目地址:POJ 1731

这题能够直接用STL函数做,非常轻松。。next_permutation函数非常给力。。

代码例如以下:

#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
using namespace std;
char s[300];
int main()
{
int len, i, n;
while(scanf("%s",s)!=EOF)
{
len=strlen(s);
sort(s,s+len);
puts(s);
while(next_permutation(s,s+len))
{
puts(s);
}
}
return 0;
}

POJ 1731 Orders(STL运用)的更多相关文章

  1. poj 1731 Orders

    http://poj.org/problem?id=1731 Orders Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9 ...

  2. poj 1731 Orders(暴力)

    题目链接:http://poj.org/problem?id=1731 思路分析:含有重复元素的全排列问题:元素个数为200个,采用暴力枚举法. 代码如下: #include <iostream ...

  3. Orders POJ - 1731

    The stores manager has sorted all kinds of goods in an alphabetical order of their labels. All the k ...

  4. POJ 1731:Orders

    Orders Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9940   Accepted: 6048 Descriptio ...

  5. POJ 2431 Expedition (STL 优先权队列)

    Expedition Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8053   Accepted: 2359 Descri ...

  6. POJ 2442 Squence (STL heap)

    题意: 给你n*m的矩阵,然后每行取一个元素,组成一个包含n个元素的序列,一共有n^m种序列, 让你求出序列和最小的前n个序列的序列和. 解题思路: 1.将第一序列读入seq1向量中,并按升序排序. ...

  7. poj 1833 排列 STL 全排列公式

    排列 Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 15173   Accepted: 6148 Description 题 ...

  8. POJ 1731

    #include<iostream> #include<string> #include<algorithm> using namespace std; int m ...

  9. POJ 1002 - 487-3279 STL

    先把不是标准格式的字符串变成标准格式再输出出现两次以上的标准串和出现的次数不然输出 "No duplicates." #include <iostream> #incl ...

随机推荐

  1. Codeforces Round #299 (Div. 2) B. Tavas and SaDDas【DFS/*进制思维/位运算/一个数为幸运数,当且仅当它的每一位要么是4,要么是7 ,求小于等于n的幸运数个数】

    B. Tavas and SaDDas time limit per test 1 second memory limit per test 256 megabytes input standard ...

  2. AtCoder Grand Contest 012 B Splatter Painting (反向处理 + 记忆化)

    题目链接  agc012 Problem B 题意  给定一个$n$个点$m$条边的无向图,现在有$q$个操作.对距离$v$不超过$d$的所有点染色,颜色编号为$c$. 求每个点最后的颜色状态. 倒过 ...

  3. Ansible 删除多个文件或目录

    翻译和转载该网页内容 http://www.mydailytutorials.com/ansible-delete-multiple-files-directories-ansible/ 背景 ans ...

  4. 分层图【p4822】[BJWC2012]冻结

    Description "我要成为魔法少女!" "那么,以灵魂为代价,你希望得到什么?" "我要将有关魔法和奇迹的一切,封印于卡片之中„„" ...

  5. codevs——1553 互斥的数

    时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题解     题目描述 Description 有这样的一个集合,集合中的元素个数由给定的N决定,集合的元素为N个不同 ...

  6. Find intersection of two sorted arrays

    共有三种思路. 哈希表. 将较小的那个数组中的所有元素存在哈希表中.然后依次验证另一个数组中的数字是否有出现过.时间复杂度O(m + n),空间复杂度O(min(m, n)) 二分搜索法 将较小的那个 ...

  7. tld自定义标签系列--使用body-content的作用--比较有用

    body-content的值有下面4种: <xsd:enumeration value="tagdependent"/> <xsd:enumeration val ...

  8. Ubuntu 16.04安装Chrome浏览器时提示:N: 忽略‘google-chrome.list.1’(于目录‘/etc/apt/sources.list.d/’),鉴于它的文件扩展名无效

    使用终端安装谷歌浏览器时,它会自动在/etc/apt/sources.list.d/这个目录下添加google-chrome.list文件,但是如果它原来就有一个google-chrome.list的 ...

  9. select自己定义属性值

    select自己定义属性值 1.问题背景 下拉框能够传递值和内容,只是有时为了传值,还须要连带其它的值也一起传过来.假设用title属性.鼠标移到下拉框上方会显示出来,这样就会导致被暴露出来.所以,为 ...

  10. mipmap一

    讲一下mipmap 生成的时候 指定texture 的mipmaplevel 8 然后memory自动就会那么大的 画的时候要在lineraspace(因为我是gpucopy所以不涉及这个问题 可能) ...