该死的入参,偏偏重要的时候与我作对
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
public class T33 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b = in.nextInt();
char[] arr = String.valueOf(a).toCharArray();
int[] newarr = new int[arr.length];
for (int i = 0; i < arr.length; i++) {
newarr[i] = (int)arr[i]-(int)'0';
}
// for (int i = 0; i < newarr.length; i++) {
// System.out.print(newarr[i]+" ");
// }
// 全排列
System.out.println(fullSort(newarr, 0, arr.length-1));
}
private static int fullSort(int[] arr, int l, int r) {
int count = 0;
if (l == r) {
String s;
for (int i : arr)
System.out.print(i+" ");
System.out.println();
}
for (int i = l; i <= r; i++) {
swap(arr, i, l);
fullSort(arr, l+1, r);
swap(arr, l, i);
}
return count;
}
private static void swap(int[] arr, int l, int r) {
int temp = arr[l];
arr[l] = arr[r];
arr[r] = temp;
}
}