@@ -0,0 +1,1523 @@
+import java.util.Arrays;%0Aimport java.util.Scanner;%0A%0Aclass Main %7B%0A    public static void main(String args%5B%5D) %7B%0A        Scanner sc = new Scanner(System.in);%0A        int T = sc.nextInt();%0A%0A        for(int i=1; i%3C=T; i++) %7B%0A            int%5B%5D cost = new int%5B36%5D;%0A%0A            for(int j=0; j%3Ccost.length; j++) %7B%0A                cost%5Bj%5D = sc.nextInt();%0A            %7D%0A%0A            int X = sc.nextInt();%0A            System.out.printf(%22Case %25d:%5Cn%22, i);%0A            for(int j=0; j%3CX; j++) %7B%0A                int%5B%5D converted = new int%5B37%5D;%0A                Arrays.fill(converted, 0);%0A%0A                int n = sc.nextInt();%0A%0A                for(int k=2; k%3C=36; k++) %7B%0A                    int b = n;%0A                    while(b %3E 0) %7B%0A                        converted%5Bk%5D += cost%5Bb%25k%5D;%0A                        b /= k;%0A                    %7D%0A                %7D%0A%0A                int lowest = getLowest(converted);%0A                System.out.printf(%22Cheapest base(s) for number %25d:%22, n);%0A                getSame(lowest, converted);%0A                System.out.println();%0A            %7D%0A            if(i != T)%0A                System.out.println();%0A        %7D%0A    %7D%0A%0A    static int getLowest(int%5B%5D arr) %7B%0A        int lowest = 999999999;%0A%0A        for(int i=2; i%3C=36; i++) %7B%0A            if(arr%5Bi%5D %3C lowest)%0A                lowest = arr%5Bi%5D;%0A        %7D%0A%0A        return lowest;%0A    %7D%0A%0A    static void getSame(int n, int%5B%5D arr) %7B%0A        for(int i=2; i%3C=36; i++) %7B%0A            if(arr%5Bi%5D == n)%0A                System.out.printf(%22 %25d%22, i);%0A        %7D%0A    %7D%0A%7D%0A

Create 11005.java