代码:
1 import java.util.*; 2 public class Main { 3 public static void main (String [] args) { 4 int repeat,m,n; 5 Scanner s=new Scanner(System.in); 6 repeat=s.nextInt(); 7 for(int i=1;i<=repeat;i++) { 8 m=s.nextInt(); 9 n=s.nextInt(); 10 for(int j=m;j<=n;j++) { 11 int sum=0; 12 int num=j; 13 while(num>0) 14 { 15 sum+=Math.pow(num%10,3); 16 num=num/10; 17 } 18 if(sum==j) { 19 System.out.println(j); 20 } 21 } 22 } 23 } 24 }
原文地址:https://www.cnblogs.com/fandehui/p/11042354.html
时间: 2024-11-13 08:03:21