poj 1146(水题)
#include<iostream> #include<algorithm> #include<cstring> using namespace std; int main(){ char data[55]; while(scanf("%s",data)==1&&strcmp(data,"#")){ if(next_permutation(data,data+strlen(data))){ printf("%s\n",data); } else{ printf("No Successor\n"); } } return 0; }

浙公网安备 33010602011771号