首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

uva 全排列标题 146 + 729 + 10098

2012-08-07 
uva 全排列题目 146 + 729 + 10098解题思路:对于全排列的问题,STL,提供了一个强大的函数,boolnext_permuta

uva 全排列题目 146 + 729 + 10098


解题思路:      对于全排列的问题,STL,提供了一个强大的函数,

                                bool   next_permutation(iterator.begin() ,  iterator.end());

                       对于当前的序列如果不是最后一个序列则返回真,否则返回假。


uva     10098 - Generating Fast 题目链接: 点击打开链接
代码:
#include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>#include <string>#include <algorithm>using namespace std;string str;int main(){    while(cin>>str){        if(str == "#")            break;        if(next_permutation(str.begin(),str.end()))            cout<<str<<endl;        else            printf("No Successor\n");    }      return 0;}


热点排行