UVA 146 ID Codes

来源:互联网 发布:深圳人工智能企业 编辑:程序博客网 时间:2024/05/21 07:59

UVA 146 ID Codes

题目大意:给出一个字符串,输出一比这字符串大的最小的下一字符串

解题思路:next_permutation函数的调用

#include <iostream>#include <string.h>#include <iostream>#include <algorithm>using namespace std;char str[1000];int main() {    while(scanf("%s", str) && str[0] != '#') {        if(next_permutation(str, str+strlen(str)))            printf("%s\n", str);        else            printf("No Successor\n");    }    return 0;}
0 0