首页 > 其他 > 详细

POJ 1731 Orders(STL运用)

时间:2017-05-05 15:07:06      阅读:284      评论:0      收藏:0      [点我收藏+]

题目地址: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运用)

原文:http://www.cnblogs.com/llguanli/p/6813041.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!