PKU 3785 The Next Permutation
http://poj.org/problem?id=3785
次の順列を生成するだけ。
出来ない場合はそのことを出力する。
易。
正直next_permutationの仕組みも知らずに使っているのが心苦しいです。
main(){ int t; cin>>t; while(t--){ int n; string in; cin>>n>>in; cout<<n<<' '; if(next_permutation(ALL(in)))cout<<in<<endl; else cout<<"BIGGEST"<<endl; } }