1) Write a program to print the perfect squares between 2000 and 3000. 
        Example: A perfect square is 25 which is between 20 and 30.        编写一个程序,print出2000 到3000 之间的所有 完全平方数。
        例如:25(即5的5次方 )是 20 到30  之间的完全平方数!

解决方案 »

  1.   

    思路,
    1、2000^0.5=44.72,a=Math.floor(44.72+1)=45
    2、3000^0.5=54.77,a=Math.floor(54.77)=54
    3、answer:45^2~54^2
      

  2.   

    ^在一些地方表示X次方,比如Matlab
      

  3.   

    能不能把  code代码 写出来,谢谢
      

  4.   

    其实很简单的,自己试一下写public class test{
    public static void main(String args[]){
    int a=400,b=899;
    int min = (int)Math.sqrt(a);
    min = min*min<a?min+1:min; //处理边界
    int max = (int)Math.sqrt(b);
    for(int i=min;i<=max;i++)
    System.out.println(i*i);
    }
    }下一次要放一点分,0分贴要被人鄙视的,好在你碰到我
      

  5.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【wu2kai】截止到2008-07-23 00:57:06的历史汇总数据(不包括此帖):
    发帖的总数量:9                        发帖的总分数:95                       每贴平均分数:10                       
    回帖的总数量:7                        得分贴总数量:0                        回帖的得分率:0%                       
    结贴的总数量:4                        结贴的总分数:20                       
    无满意结贴数:0                        无满意结贴分:0                        
    未结的帖子数:5                        未结的总分数:75                       
    结贴的百分比:44.44 %               结分的百分比:21.05 %                  
    无满意结贴率:0.00  %               无满意结分率:0.00  %                  
    楼主该结一些帖子了