一个整数,它加上100后是一个完全平方数,再加上168后又是一个完全平方数,请问该数是多少?(数字小于100000)

 

代码:

 1 public class Main{
 2     public static void main (String [] args) {
 3         for(int i=0;i<100000;i++) {
 4             int a=i+100;
 5             int b=a+168;
 6             if((Math.sqrt(a)%2==0||Math.sqrt(a)%2==1)&&(Math.sqrt(b)%2==0||Math.sqrt(b)%2==1)) 
 7             {
 8                 System.out.println(i);
 9             }
10         }
11     }
12 }

 

posted @ 2019-06-18 17:01  DehuiFan  阅读(1254)  评论(0)    收藏  举报