日期:2014-05-20 浏览次数:20758 次
a*a*a*a*a*a*a*a+b*b*b*b*b*b*b*b+c*c*c*c*c*c*c*c == k
------解决方案--------------------
long s, t, n = 8; for (long i = (long) Math.pow(10, n - 1); i < Math.pow(10, n); i++) { s = 0; for (int j = 1; j <= n; j++) { if (j == 1) t = i % 10; else t = (long) (i % Math.pow(10, j) / Math.pow(10, j - 1)); s += Math.pow(t, n); } if (s == i) { System.out.println(s); } } System.out.println("over");
------解决方案--------------------
long s, t, n = 4; for (long i = (long) Math.pow(10, n - 1); i < Math.pow(10, n); i++) { s = 0; for (int j = 1; j <= n; j++) { t = (long) (i % Math.pow(10, j) / Math.pow(10, j - 1)); s += Math.pow(t, n); } if (s == i) { System.out.println(s); } } System.out.println("over");
------解决方案--------------------
long s, t, n = 8; for (long i = (long) Math.pow(10, n - 1); i < Math.pow(10, n); i++) { s = 0; for (int j = 1; j <= n; j++) { t = (long) (i % Math.pow(10, j) / Math.pow(10, j - 1)); s += Math.pow(t, n); } if (s == i) { System.out.println(s); } } System.out.println("over");