赞
踩
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); while(cin.hasNext()) { int m=cin.nextInt(); int n=cin.nextInt(); int flag=1; for(int i=m;i<=n;i++) { if(narcissus(i)==1) { if(flag==1) { System.out.printf("%d", i); flag=0; } else System.out.printf(" %d",i); } } if(flag==1) System.out.println("no"); else System.out.println(); } } public static int narcissus(int n) { int d1=n%10; int d2=n/10%10; int d3=n/100; if(n==d1*d1*d1+d2*d2*d2+d3*d3*d3) return 1; else return 0; } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。