Friday, October 29, 2010

ACM - UVA 146 - ID Codes

Problem:146 - ID Codes
Solution: C++

Hints: http://www.algorithmist.com/index.php/UVa_146
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <sstream>
#include <utility>
#include <set>
#include <math.h>
using namespace std;

int main()
{
    while(1)
    {
        char sor[55];
        gets(sor);
        if(sor[0] == '#')

            break;
        if(!next_permutation(sor,sor+strlen(sor)))
        {
             puts("No Successor");

            continue;
        }
        puts(sor);
    }

    return 0;
}
  

No comments:

Post a Comment