package margusmartseppcode.From_30_to_39; public class Problem_30 { public static void main(String[] args) { int EXP = 5, i = 10, s = 0, t = 0; long max = (long) (Math.pow(9.0, EXP) * (EXP - 1)); for (int n = i; n < max; t += (s == n ? s : 0), n++, s = 0) for (i = n; i > 0; i /= 10) s += Math.pow((i % 10), EXP); System.out.println(t); } }
No comments:
Post a Comment