题目地址: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. Javascript中call、apply函数浅析

    call/apply函数作用其实就是改变this的取值,有一句话是:谁调用的这个方法那方法里的this就是指谁,而有时我们会需要改变this值,所以call/apply就能派上用场. 下面我写个方法来 ...

  2. 反射main方法

    利用Java反射机制去调用其他类的main方法基于这种情形: 当程序中的某个类在运行到某处需要去调用其他类的main方法时,如果此程序并不知道此main方法所属类的名称,而只是在程序中接受某一代表此m ...

  3. Path Sum II (Find Path in Tree) -- LeetCode

    Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given su ...

  4. Calendar对象

    1.简单获取年月日 代码示例: package others; import java.util.Calendar; public class CalenderDemo1 { /** * @param ...

  5. 每天一个linxu命令6之jps  查看java进程的端口

    jps -- JavaVirtual Machine Process Status Tool 可以列出本机所有Java进程的pid jps [ options ] [ hostid ] 选项 -q 仅 ...

  6. TranslateAnimation详解 Android动画。

    TranslateAnimation详解 Android JDK为我们提供了4种动画效果,分别是: AlphaAnimation,RotateAnimation, ScaleAnimation, Tr ...

  7. 玩转Nuget服务器搭建(二)

    之所以分开来写这几部分,是因为今天搭建的过程中,碰到了几个问题,特别提一下,让大家省下这部分时间(毕竟人生苦短嘛,你如果就是闲的蛋疼,请给我你的GUID,我送你几瓶风油精). NugetServer ...

  8. Oracle多用户对一个表进行并发插入数据行操作

    oracle数据库支持多用户间同时对同一个表进行操作,但是数据不一定同步,因为oracle数据库是支持脏数据的,比如A用户删除了表的数据但没有提交,B用户也能查询访问到,如果要避免这种情况只能加锁,A ...

  9. 解读TDD的五大误区

    所谓TDD简单地说就是以下两个步骤:确保所有的需求都能被照顾到:在代码不断增加和重构的过程中,可以检查所有的功能是否正确.本文我们一起来看下关于TDD的五大误区. TDD(全称Test Driven ...

  10. 发布Android开源库,看这个文章就够了!

    最近在Flipboard实习期间写了一个轮播工具,技术上没什么难点,不过动画效果还是不错的,决定改改代码写个库开源出去.项目地址:http://github.com/chengdazhi/Decent ...