solution.java 1.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
public class MAHUSUANSHI {
    public static void main(String[] args) {
        int ans = 0;
        for (int a = 1; a < 10; a++) {
            for (int b = 1; b < 10; b++) {
                if (b != a)
                    for (int c = 1; c < 10; c++) {
                        if (c != a && c != b)
                            for (int d = 1; d < 10; d++) {
                                if (d != a && d != b && d != c)
                                    for (int e = 1; e < 10; e++) {
                                        if (e != a && e != b && e != c && e != d) {
                                            if ((a * 10 + b) * (c * 100 + d * 10 + e) == (a * 100 + d * 10 + b)
                                                    * (c * 10 + e)) {
                                                ans++;
                                                System.out.printf(
                                                        "(d%*10+d%)*(d%*100+d%*10+d%)==(d%*100+d%*10+d%)*(d%*10+d%)==d%\n",
                                                        a, b, c, d, e, a, d, b, c, e,
                                                        (a * 10 + b) * (c * 100 + d * 10 + e) == (a * 100 + d * 10 + b)
                                                                * (c * 10 + e));
                                            }
                                        }
                                    }
                            }
                    }
            }
        }
        System.out.println(ans);
    }
}