题目地址: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. CentOS6.5升级autoconf版本,解决”Autoconf version 2.64 or higher is required“错误

    CentOS6.5升级autoconf版本,解决”Autoconf version 2.64 or higher is required“错误 https://blog.csdn.net/pretty ...

  2. 自己写Tiny6410的Bootloader总结!

    1.由于Tiny6410 2G版的Nand flash(K9GAG08U0E)的页大小是8K的,但是s3c6410芯片设置为nand flash启动时先从nand flash复制8K代码到片内内存中去 ...

  3. SQL获取当月天数的几种方法

    原文:SQL获取当月天数的几种方法 日期直接减去int类型的数字 等于 DATEADD(DAY,- 数字,日期) 下面三种方法: 1,日期加一个月减去当前天数,相当于这个月最后一天的日期.然后获取天数 ...

  4. Word中更新交叉引用

    方法一:选择要更新的域,按F9键即可. 方法二:右键单击要更新的域,在弹出的右键菜单中选择“更新域”即可. 方法三:若域位于一个含有“更新”按钮的特定容器中,则点击“更新”即可.

  5. 今天在CSDN看懂这个帖子,也是我的困惑,记录一下(过了三十的码农,你选择的是哪个,说出你的想法)

    http://bbs.csdn.net/topics/390944177 1.继续开发生涯,做资深码农,从senior.team lead.tech lead到principal,如果你无欲无求,可以 ...

  6. JAVA常见算法题(十一)

    package com.xiaowu.demo; /** * 有1.2.3.4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少? * * * @author WQ * */ public c ...

  7. docker 常用 命令

    http://os.51cto.com/art/201409/451117.htm 2.1 在测试机启动容器,安装ssh docker run -i -t ubuntu /bin/bash #此方式运 ...

  8. python调用top命令获得CPU利用率

    1.python调用top命令获得CPU利用率 思路:通过python调用top命令获取cpu使用率 #python2代码 [root@zdops-server script]# cat cpu_lo ...

  9. 资源的GPUAddress

    BufferAddress CommandHandle TextureHandle 给shader采样的 ImageHandle 给shader  load store的.../imageLoad() ...

  10. 全栈技术经理——团队管理:每周问问你的团队这这些问题 V1.0

    全栈技术经理--团队管理:每周问问你的团队这这些问题 V1.0 1.本周取得了哪些进展? ​ 通过回答这个问题可以让员工庆祝甚至夸耀一些自己的成果,包括那些跟最高优先级不相干而被忽视的小事情.借此你也 ...