POJ 1731 Orders STL 中string的应用
来源:岁月联盟
时间:2012-08-17
思路:直接用next_permutation水过。
代码:
[cpp]
#include <iostream>
#include <cstdio>
#include <string.h>
#include <algorithm>
#include <string>
using namespace std;
int main(){
char ss[210];
while(gets(ss)){
int len = strlen(ss);
sort(ss,ss+len);
puts(ss);
while( next_permutation(ss,ss+len) ){
puts(ss);
}
}
return 0;
}
下一篇:poj 2299