7.2.2(next_permutation--STL)
2013-02-06 20:51
260 查看
库函数用起来是方便很多,
但就是我没有MSDN呀,,所以木发看源代码..
不管了...这明显要迅速,要简单呀..呵呵
贴出代码哈,呼呼:
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
char str[1111];
int main()
{
while (scanf("%s", str) != EOF)
{
cout << endl;
int n = strlen(str);
sort(str, str + n); // 用全排列的方法就是先排序,,晕死了都.
puts(str);
while (next_permutation(str, str + n)) // 反正方便,嘿嘿...
{
puts(str);
}
}
system("pause");
return 0;
}
但就是我没有MSDN呀,,所以木发看源代码..
不管了...这明显要迅速,要简单呀..呵呵
贴出代码哈,呼呼:
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
char str[1111];
int main()
{
while (scanf("%s", str) != EOF)
{
cout << endl;
int n = strlen(str);
sort(str, str + n); // 用全排列的方法就是先排序,,晕死了都.
puts(str);
while (next_permutation(str, str + n)) // 反正方便,嘿嘿...
{
puts(str);
}
}
system("pause");
return 0;
}
相关文章推荐
- STL里面的next_permutation求字典序排列问题
- STL(next_permutation)poj 1833:排列
- 【STL】next_permutation的原理和使用
- STL中用next_permutation解决排列问题
- 计算下一个全排列(以STL中的next_permutation为例)
- STL学习笔记之next_permutation(下一个排列)
- 全排列(STL next_permutation)
- stl算法:next_permutation剖析
- STL中的全排列next_permutation
- hdu1027 全排列(STL函数next_permutation)
- STL 源代码剖析 算法 stl_algo.h -- next_permutation
- STL快速全排列函数next_permutation与pre_permutation
- STL next_permutation(a,a+n) 生成一个序列的全排列。满足可重集。
- hdu 1027 STL next_permutation
- STL 排序算法之全排列sort和next_permutation
- STL经典算法集锦之排列(next_permutation/prev_permutation
- [STL]next_permutation
- [POJ1833] 排列(STL之next_permutation)
- 【C++_STL_next_permutation】全排列讲解
- 【C++ STL应用与实现】62: 如何使用std::next_permutation