题目地址: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. 如何跳转到其他APP(android)

    有很多小伙伴会遇上这样的需求,从自己的app页面跳转到其他APP界面,一般情况下都是在自己的主包中跳转到公司其他APP,或者是合作方的APP,如果手机中没有这款APP会下载这款APP . 今天,博主就 ...

  2. DP【p2051(bzoj 1801)】 [AHOI2009]中国象棋.

    题目描述 这次小可可想解决的难题和中国象棋有关,在一个N行M列的棋盘上,让你放若干个炮(可以是0个),使得没有一个炮可以攻击到另一个炮,请问有多少种放置方法.大家肯定很清楚,在中国象棋中炮的行走方式是 ...

  3. Codeforces 920 E Connected Components?

    Discription You are given an undirected graph consisting of n vertices and  edges. Instead of giving ...

  4. 在SQL Server中查看对象依赖关系

    原文 在SQL Server中查看对象依赖关系 Viewing object dependencies in SQL Server   Deleting or changing objects may ...

  5. K均值与C均值区别

    k均值聚类:---------一种硬聚类算法,隶属度只有两个取值0或1,提出的基本根据是“类内误差平方和最小化”准则: 模糊的c均值聚类算法:-------- 一种模糊聚类算法,是k均值聚类算法的推广 ...

  6. UBI - Unsorted Block Images

    参考:http://www.linux-mtd.infradead.org/doc/ubi.html UBI - Unsorted Block Images Table of contents Big ...

  7. Asp.net+EF

    EFRepositoryBase using System; using System.Collections.Generic; using System.Data; using System.Dat ...

  8. JAVA中使用freemark生成自定义文件(json、excel、yaml、txt)

    原文:http://blog.csdn.net/jinzhencs/article/details/51461776 场景:在我们工作中,有时需要生成一些文件,可能它不是一种标准的格式,比如JSON. ...

  9. GoodSync

    文件管理这件看 似简单的事,真的不简单,因为为了防止意外情况,你需要对文件进行备份,时间一久随着文件数量的增加,再加上有时也会临时队备份文件进行修改等.再想查出 这个是最新的.文件有木有全部备份等…. ...

  10. 资源相互引用时 需添加 PerformSubstitution=True

    获取或设置一个布尔值,该值确定在对由 WebResourceAttribute 类引用的嵌入式资源的处理过程中是否分析其他 Web 资源 URL,并用到该资源的完整路径替换. 如:一个CSS文件引用其 ...