# Include <iostream>
Using namespace STD;
Bool used [9]; // use cases from 1 to 9 to determine whether the service is used
Int COUNT = 0; // The number of 9*8*7*6*5*4*3*2
Void print (INT, INT );
Void add (Int &, Int, INT );
Void store (bool *);
Void reset (bool *);
Int main (INT argc, char * argv [])
{
Print (0, 8 );
Cout <"Count =" <count <Endl; // number of output results
Return true;
}
Void print (INT num, int N)
{
Int I;
Int firstnum;
Bool store [9];
If (n> = 1)
{
For (I = 0; I <9; I ++)
{
If (! Used [I])
{
Store );
Firstnum = num;
Used [I] = true;
Add (Num, I + 1, n );
Print (Num, n-1 );
Reset (store );
Num = firstnum;
}
}
}
Else if (n = 0)
{
For (I = 0; I <9 ;)
{
If (used [I])
{
I ++;
}
Else if (! Used [I])
{
Num + = I + 1;
// Cout <num <Endl; // input the result of the permutation and combination to the screen, and the output is time-consuming.
Count ++;
Break;
}
}
}
}
Void add (Int & num, int integer, int N)
{
Int I;
For (I = 0; I <n; I ++)
{
Integer * = 10;
}
Num + = integer;
}
Void store (bool * store)
{
Int I;
For (I = 0; I <9; I ++)
{
* Store = used [I];
Store ++;
}
}
Void reset (bool * store)
{
Int I;
For (I = 0; I <9; I ++)
{
Used [I] = * store;
Store ++;
}
}