| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:使用C++STL中的next_permutation()可以大大简化此题的难度In Reply To:Re:使用C++STL中的next_permutation()可以大大简化此题的难度 Posted by:qianguangpan at 2010-05-01 15:50:50 my_code:
#include <iostream>
#include <algorithm>
using namespace std;
char str[51];
int main(void)
{
while(scanf("%s",str))
{
if(str[0]=='#')
break;
if(next_permutation(str,str+strlen(str)))
{
printf("%s\n",str);
}
else
{
printf("No Successor\n");
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator