a040.
阿姆斯壯數
| From: [111.240.202.82] |
發表日期
:
2015-07-04 19:14
import java.util.*;
public class A040 {
// 阿姆斯壯數 荷花
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int n = sc.nextInt();
int m = sc.nextInt();
if (m > n) {
if (m < 1001 && n > 99) {
for (int i = 100; i < 1000; i++) {
int a = i / 100;
int b = (i % 100) / 10;
int c = i % 10;
if (a * a * a + b * b * b + c * c * c == i)
System.out.print(i + " ");
}
System.out.println( );
}
if (m < 10001 && n > 999) {
for (int i = 1000; i < 10000; i++) {
int e = i % 10;
int f = i / 10 % 10;
int g = i / 100 % 10;
int h = i / 1000;
if (i == e * e * e * e + f * f * f * f + g * g * g * g
+ h * h * h * h)
System.out.print(i + " ");
}
System.out.println( );
}
if (m < 100 && n > 0)
System.out.println("none");
}
}
}
}