查找最大不重复数

#include <iostream>
using namespace std;
unsigned int GetNotRepeatNum(unsigned int Value)
{
    bool flag = true;
    unsigned int result = Value;
    while (flag)
    {
        result++;
        int figure = result % 10;
        int shang = result / 10;
        while (shang)
        {
            if ((shang % 10) ^ figure)
            {
                figure = shang % 10;
                shang /= 10;
                flag = false;
            }
            else
            {
                flag = true;
                break;
            }
        }
    }
    return result;
}

void main()
{
    cout << GetNotRepeatNum(1335) << endl;
    system("pause");
}

 

posted @ 2016-05-20 16:06  ShellHan  阅读(245)  评论(0编辑  收藏  举报