题解 | #变种水仙花#
变种水仙花
http://www.nowcoder.com/practice/c178e3f5cc4641dfbc8b020ae79e2b71
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); for(int i=10000;i<=99999;i++) { int sum=0; for(int j=1;j<=5;j++) { int qian = i / (int)Math.pow(10,j); int hou = i % (int)Math.pow(10,j); sum+=qian*hou; } if(sum==i) { System.out.print(i+" "); } } } }