输入M,N,输出M-N之间的所有水仙花数,如没有,输出no
package LT;
import java.util.Scanner;
/**
*
* @author 李廷
* @ClassName: Main_001
* @Version 1.5
* @Copyright JLJU
* @date 2017年3月17日 下午10:01:33
* @description 类描述
*/
public class Main_001 {
public static boolean isShui(int n) {
int g, s, b;
g = n % 10;
s = n / 10 % 10;
b = n / 100;
if ((Math.pow(g, 3) + Math.pow(s, 3) + Math.pow(b, 3)) == n) {
return true;
} else {
return false;
}
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int m = scanner.nextInt();
int n = scanner.nextInt();
boolean a = false;
int count = 0;
for (int i = m; i <= n; i++) {
a = isShui(i);
if (a == true) {
System.out.print(i + " ");
count++;
}
}
if (count == 0) {
System.out.println("no");
}
}
}