/**
* Given an integer N (1 <n <9), it is not very efficient to calculate the full arrangement of 1-N!
*
*/
Public void testhh (){
While (true ){
Running in = New Processing (system. In );
Int n = in. nextint ();
If (n = 3 ){
Ff3 (N );
} Else if (n = 4 ){
Ff4 (N );
} Else if (n = 2 ){
Ff2 (N );
} Else if (n = 5 ){
Ff5 (5 );
} Else if (n = 6 ){
Ff6 (6 );
} Else if (n = 7 ){
Ff7 (N );
} Else if (n = 8 ){
Ff8 (N );
} Else {
System. Out. Print ("the number you entered is not within (1 <n <9). Please enter again :");
}
}
}
Public void ff2 (int n ){
For (INT I = 1; I <= N; I ++)
For (int K = 1; k <= N; k ++)
{
If (I = K)
Continue;
Else
System. Out. println (I * 10 + k );
}
}
Public void ff3 (int n ){
For (INT I = 1; I <= N; I ++)
For (Int J = 1; j <= N; j ++)
For (int K = 1; k <= N; k ++)
{
If (I = j | I = k | j = K)
Continue;
Else
System. Out. println (I * 100 + J * 10 + k );
}
}
Public void ff4 (int n ){
For (INT I = 1; I <= N; I ++)
For (Int J = 1; j <= N; j ++)
For (int A = 1; A <= N; A ++)
For (int K = 1; k <= N; k ++)
{
If (I = j | I = k | j = k | A = j | A = k | A = I)
Continue;
Else
System. Out. println (I * 1000 + J * 100 + K * 10 + );
}
}
Public void ff5 (int n ){
For (INT I = 1; I <= N; I ++)
For (Int J = 1; j <= N; j ++)
For (int A = 1; A <= N; A ++)
For (INT B = 1; B <= N; B ++)
For (int K = 1; k <= N; k ++)
{
If (I = j | I = k | j = k | A = j | A = k | A = I | B = = I | B = j | B = k | B =)
Continue;
Else
System. Out. println (B * 10000 + I * 1000 + J * 100 + K * 10 + );
}
}
Public void ff6 (int n ){
For (INT I = 1; I <= N; I ++)
For (Int J = 1; j <= N; j ++)
For (int A = 1; A <= N; A ++)
For (INT B = 1; B <= N; B ++)
For (INT c = 1; C <= N; C ++)
For (int K = 1; k <= N; k ++)
{
If (I = j | I = k | j = k | A = j | A = k | A = I | B = = I | B = j | B = k | B = A | C = I | C = J
| C = k | C = A | C = B)
Continue;
Else
System. Out. println (C * 100000 + B * 10000 + I * 1000 + J * 100 + K * 10 + );
}
}
Public void ff7 (int n ){
For (INT I = 1; I <= N; I ++)
For (Int J = 1; j <= N; j ++)
For (int A = 1; A <= N; A ++)
For (INT B = 1; B <= N; B ++)
For (INT c = 1; C <= N; C ++)
For (INT d = 1; D <= N; D ++)
For (int K = 1; k <= N; k ++)
{
If (I = j | I = k | j = k | A = j | A = k | A = I | B = = I | B = j | B = k | B = A | C = I | C = J
| C = k | C = A | C = B | D = I | D = j | D = k | D = = A | D = B | C = D)
Continue;
Else
System. Out. println (D * 1000000 + C * 100000 + B * 10000 + I * 1000 + J * 100 + K * 10 + );
}
}
Public void ff8 (int n ){
For (INT I = 1; I <= N; I ++)
For (Int J = 1; j <= N; j ++)
For (int A = 1; A <= N; A ++)
For (INT B = 1; B <= N; B ++)
For (INT c = 1; C <= N; C ++)
For (INT d = 1; D <= N; D ++)
For (int e = 1; E <= N; e ++)
For (int K = 1; k <= N; k ++)
{
If (I = j | I = k | j = k | A = j | A = k | A = I | B = = I | B = j | B = k | B = A | C = I | C = J
| C = k | C = A | C = B | D = I | D = j | D = k | D = = A | D = B | C = d | E = I | E = J
| E = k | E = A | E = B | E = c | E = D)
Continue;
Else
System. Out. println (E * 10000000 + D * 1000000 + C * 100000 + B * 10000 + I * 1000 + J * 100 + K * 10 + );
}
}