Image

Imagecaching wrote in Imagecpp

Sorry for being a bother, but here's my algorithm. Any help is most awesome.

The idea is to take the numbers 0-9, put them in a 5 digit number
sequence (abcde), multiply abcde by 2 and then test each
digit so that it only occurs one time.

so for example:

09327  = 18654 (twice the number)
20679  = 41358 " "
48651  = 97302 " "

those are the only 3 that work out which are 5 digits long and each
number occurs exactly once.

i'm going to use a boolean array to test each of the digits, but
I can't find any references on how to do so. that's also
the only option i have. i know i have to set all the items
in the array all to false...

for all practical purposes i know my code has errors and
might not make much sense, but here's what i have so far...

please try to be specific and patient.



#include
#include

using namespace std;

int main()
{
        int abcde;
        int a,b,c,d,e;
        int fghij;
        int f, g, h, i, j;

        bool Digits[10] = {0,1,2,3,4,5,6,7,8,9};
       
        int n = abcde;
        int twicen = n*2;

        abcde = 10000;
        while(abcde<=99999)
        {
                a = abcde/10000;
                b = (abcde/1000)%10;
                c = (abcde/100)%10;
                d = (abcde/10)%10;
                e = abcde%10;       
        }
       
        fghij = 10000;
        while(fghij<=99999)
        {
                f = fghij/10000;
                g = (fghij/1000)%10;
                h = (fghij/100)%10;
                i = (fghij/10)%10;
                j = fghij%10;
        }

        return EXIT_SUCCESS;
}