【水一发next_permutation】poj 1146——ID Codesm

来源:点击打开链接

求字典序下一位,没有直接输出没有。全排列函数秒水过。

 

#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
using namespace std;

int main()
{
	int testcase;
	string tar;
	while(cin>>tar && tar!="#")
	{
		if(next_permutation(tar.begin(),tar.end()))
		{
			cout<<tar<<endl;
		}
		else
		{
			cout<<"No Successor"<<endl;
		}
		
	}
}


 

 

posted on 2013-08-14 19:03  you Richer  阅读(198)  评论(0)    收藏  举报