Uva--146 (暴力,next_permutation)

2014-07-10 01:57:37

题意&思路:不赘述,直接next_permutation。

 1 #include <cstdio>
 2 #include <cstring>
 3 #include <algorithm>
 4 #include <iostream>
 5 using namespace std;
 6 
 7 int main(){
 8     char s[55];
 9     while(scanf("%s",s) == 1){
10         if(s[0] == '#') break;
11         if(next_permutation(s,s + strlen(s))) cout << s;
12         else cout << "No Successor";
13         puts("");
14     }
15     return 0;
16 }
17     

 

posted @ 2014-07-10 01:58  Naturain  阅读(128)  评论(0)    收藏  举报