分析:这题也可以自己写,但是使用STL的函数next_permutation就非常方便了。
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
int t,n;
char a[100];
cin>>t;
while(t--)
{
cin>>n>>a;
if(next_permutation(a,a+strlen(a)))
cout<<n<<" "<<a<<endl;
else
cout<<n<<" BIGGEST"<<endl;
}
return 0;
}
HDU ACM 3282 The Next Permutation->自从了解了STL,做题都省心多了
原文地址:http://blog.csdn.net/a809146548/article/details/45701345